{"id":1042,"date":"2025-06-12T11:17:23","date_gmt":"2025-06-12T03:17:23","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/php\/php-application-manual\/symfony\/1042.html"},"modified":"2025-06-12T11:17:23","modified_gmt":"2025-06-12T03:17:23","slug":"%e4%bd%bf%e7%94%a8bin-console%e5%91%bd%e4%bb%a4%e8%b0%83%e8%af%95symfony","status":"publish","type":"my1js","link":"https:\/\/www.zhaozhao123.cn\/php\/my1js\/1042.html","title":{"rendered":"\u4f7f\u7528bin\/console\u547d\u4ee4\u8c03\u8bd5Symfony"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--1\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/dyA-1-400x300.jpg\" alt=\"Bug&#32534;&#35793;&#29422;\" class=\"wp-image-1842\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading my-0\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.175), 1rem);\">Bug&#32534;&#35793;&#29422;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#24403;&#28982;&#21487;&#20197;&#65281;&#35843;&#35797; Symfony &#24212;&#29992;&#31243;&#24207;&#36890;&#24120;&#28041;&#21450;&#20351;&#29992; PHP &#30340;&#25511;&#21046;&#21488;&#24037;&#20855; <code>bin\/console<\/code>&#12290;&#20197;&#19979;&#26159;&#19968;&#20123;&#24120;&#35265;&#30340;&#35843;&#35797;&#27493;&#39588;&#21644;&#31034;&#20363;&#20195;&#30721;&#65306;<\/p>\n<h3>1. &#21551;&#21160;&#25511;&#21046;&#21488;<\/h3>\n<p>&#39318;&#20808;&#65292;&#30830;&#20445;&#20320;&#30340; Symfony &#24212;&#29992;&#24050;&#32463;&#21551;&#21160;&#24182;&#36816;&#34892;&#12290;&#20320;&#21487;&#20197;&#36890;&#36807;&#20197;&#19979;&#21629;&#20196;&#26469;&#21551;&#21160;&#25511;&#21046;&#21488;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console server:run<\/code><\/pre>\n<p>&#36825;&#23558;&#21551;&#21160;&#19968;&#20010;&#26412;&#22320;&#24320;&#21457;&#26381;&#21153;&#22120;&#65292;&#24182;&#25171;&#24320;&#27983;&#35272;&#22120;&#26174;&#31034;&#20320;&#30340;&#24212;&#29992;&#12290;<\/p>\n<h3>2. &#20351;&#29992; <code>debug:lint<\/code> &#21629;&#20196;&#26816;&#26597;&#20195;&#30721;&#39118;&#26684;<\/h3>\n<p><code>debug:lint<\/code> &#21629;&#20196;&#21487;&#20197;&#24110;&#21161;&#20320;&#26816;&#26597;&#20320;&#30340;&#20195;&#30721;&#26159;&#21542;&#31526;&#21512;&#26368;&#20339;&#23454;&#36341;&#65292;&#24182;&#19988;&#27809;&#26377;&#35821;&#27861;&#38169;&#35823;&#12290;&#20320;&#21487;&#20197;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console debug:lint<\/code><\/pre>\n<h3>3. &#20351;&#29992; <code>debug:render<\/code> &#21629;&#20196;&#28210;&#26579;&#27169;&#26495;<\/h3>\n<p>&#22914;&#26524;&#20320;&#38656;&#35201;&#26597;&#30475;&#26576;&#20010;&#27169;&#26495;&#30340;&#36755;&#20986;&#65292;&#21487;&#20197;&#20351;&#29992; <code>debug:render<\/code> &#21629;&#20196;&#12290;&#20363;&#22914;&#65292;&#22914;&#26524;&#20320;&#24819;&#26597;&#30475; <code>app\/Resources\/views\/default\/index.html.twig<\/code> &#27169;&#26495;&#30340;&#36755;&#20986;&#65292;&#21487;&#20197;&#36816;&#34892;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console debug:render app\/Resources\/views\/default\/index.html.twig<\/code><\/pre>\n<h3>4. &#20351;&#29992; <code>debug:container<\/code> &#21629;&#20196;&#26597;&#30475;&#23481;&#22120;&#37197;&#32622;<\/h3>\n<p><code>debug:container<\/code> &#21629;&#20196;&#21487;&#20197;&#24110;&#21161;&#20320;&#26597;&#30475;&#24212;&#29992;&#31243;&#24207;&#30340;&#20381;&#36182;&#27880;&#20837;&#23481;&#22120;&#37197;&#32622;&#12290;&#20320;&#21487;&#20197;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console debug:container<\/code><\/pre>\n<h3>5. &#20351;&#29992; <code>debug:router<\/code> &#21629;&#20196;&#26597;&#30475;&#36335;&#30001;&#20449;&#24687;<\/h3>\n<p><code>debug:router<\/code> &#21629;&#20196;&#21487;&#20197;&#24110;&#21161;&#20320;&#26597;&#30475;&#24212;&#29992;&#31243;&#24207;&#30340;&#36335;&#30001;&#20449;&#24687;&#12290;&#20320;&#21487;&#20197;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console debug:router<\/code><\/pre>\n<h3>6. &#20351;&#29992; <code>debug:event-dispatcher<\/code> &#21629;&#20196;&#26597;&#30475;&#20107;&#20214;&#35843;&#24230;&#22120;<\/h3>\n<p><code>debug:event-dispatcher<\/code> &#21629;&#20196;&#21487;&#20197;&#24110;&#21161;&#20320;&#26597;&#30475;&#24212;&#29992;&#31243;&#24207;&#30340;&#20107;&#20214;&#35843;&#24230;&#22120;&#37197;&#32622;&#12290;&#20320;&#21487;&#20197;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console debug:event-dispatcher<\/code><\/pre>\n<h3>&#31034;&#20363;&#20195;&#30721;&#65306;&#21019;&#24314;&#19968;&#20010;&#31616;&#21333;&#30340;&#25511;&#21046;&#22120;<\/h3>\n<p>&#20551;&#35774;&#20320;&#26377;&#19968;&#20010;&#31616;&#21333;&#30340;&#25511;&#21046;&#22120; <code>HelloController<\/code>&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#20197;&#19979;&#20195;&#30721;&#26469;&#35843;&#35797;&#23427;&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ src\/Controller\/HelloController.php\n\nnamespace AppController;\n\nuse SymfonyBundleFrameworkBundleControllerAbstractController;\nuse SymfonyComponentHttpFoundationResponse;\n\nclass HelloController extends AbstractController\n{\n    public function index(): Response\n    {\n        \/\/ &#25171;&#21360;&#19968;&#20123;&#20449;&#24687;&#21040;&#25511;&#21046;&#21488;\n        $this-&gt;logger-&gt;info('This is a test log message.');\n\n        \/\/ &#36820;&#22238;&#19968;&#20010;&#21709;&#24212;\n        return new Response('Hello, World!');\n    }\n}<\/code><\/pre>\n<p>&#28982;&#21518;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992; <code>debug:container<\/code> &#21629;&#20196;&#26469;&#26597;&#30475;&#36825;&#20010;&#25511;&#21046;&#22120;&#30340;&#20381;&#36182;&#27880;&#20837;&#65306;<\/p>\n<pre><code class=\"language-bash\">php bin\/console debug:container | grep HelloController<\/code><\/pre>\n<p>&#36825;&#23558;&#26174;&#31034; <code>HelloController<\/code> &#25511;&#21046;&#22120;&#30340;&#25152;&#26377;&#20381;&#36182;&#39033;&#12290;<\/p>\n<p>&#24076;&#26395;&#36825;&#20123;&#27493;&#39588;&#33021;&#24110;&#21161;&#20320;&#26356;&#22909;&#22320;&#35843;&#35797; Symfony &#24212;&#29992;&#31243;&#24207;&#12290;&#22914;&#26524;&#26377;&#20219;&#20309;&#38382;&#39064;&#65292;&#35831;&#38543;&#26102;&#25552;&#38382;&#65281;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--2\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/zp-400x300.jpg\" alt=\"&#40657;&#26495;Bug&#35762;&#24072;\" class=\"wp-image-1849\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading my-0\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.175), 1rem);\">&#40657;&#26495;Bug&#35762;&#24072;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<body><h2>&#20171;&#32461;<\/h2><p>&#32534;&#20889;&#39640;&#25928;&#19988;&#26080;bug&#30340;&#20195;&#30721;&#26159;Web&#24320;&#21457;&#20013;&#30340;&#19968;&#20010;&#37325;&#35201;&#20803;&#32032;&#12290;Symfony&#65292;&#19968;&#20010;&#24378;&#22823;&#30340;PHP&#26694;&#26550;&#65292;&#25552;&#20379;&#20102;&#22810;&#31181;&#24037;&#20855;&#26469;&#24110;&#21161;&#23454;&#29616;&#36825;&#19968;&#30446;&#26631;&#65292;&#21253;&#25324;&#24378;&#22823;&#30340;ORM&#65288;&#23545;&#35937;&#20851;&#31995;&#26144;&#23556;&#65289;&#12289;&#32531;&#23384;&#31995;&#32479;&#12289;AOP&#65288;&#38754;&#21521;&#20999;&#38754;&#32534;&#31243;&#65289;&#20197;&#21450;&#21508;&#31181;&#23454;&#29992;&#30340;&#21629;&#20196;&#34892;&#24037;&#20855;&#31561;&#12290;<code>bin\/console<\/code>&#25351;&#20196;&#12290;&#26412;&#25945;&#31243;&#23558;&#25351;&#23548;&#24744;&#20351;&#29992;&#20854;&#20013;&#30340;&#32454;&#33410;&#12290;<code>bin\/console<\/code>&#20026;&#20102;&#35843;&#35797;&#24744;&#30340;Symfony&#24212;&#29992;&#31243;&#24207;&#12290;&#20511;&#21161;&#29983;&#25104;&#26679;&#26495;&#20195;&#30721;&#30340;&#33021;&#21147;&#12289;&#37197;&#32622;&#24212;&#29992;&#20197;&#21450;&#25490;&#26597;&#38169;&#35823;&#65292;<code>bin\/console<\/code>Symfony&#24320;&#21457;&#20154;&#21592;&#19981;&#21487;&#25110;&#32570;&#30340;&#30431;&#21451;&#12290;<\/p><h2>&#24320;&#22987;&#20351;&#29992; bin\/console<\/h2><p>&#22312;&#28145;&#20837;&#22797;&#26434;&#35843;&#35797;&#25216;&#26415;&#20043;&#21069;&#65292;&#20102;&#35299;&#22522;&#26412;&#30340;&#35843;&#35797;&#22522;&#30784;&#30693;&#35782;&#33267;&#20851;&#37325;&#35201;&#12290;<code>bin\/console<\/code>&#21629;&#20196;&#34892;&#24037;&#20855;&#38543;&#25152;&#26377;Symfony&#24212;&#29992;&#31243;&#24207;&#19968;&#36215;&#25552;&#20379;&#65292;&#24182;&#36890;&#36807;&#21629;&#20196;&#34892;&#25191;&#34892;&#12290;&#20197;&#19979;&#26159;&#19968;&#20123;&#21021;&#27493;&#21629;&#20196;&#65292;&#24110;&#21161;&#24744;&#24320;&#22987;&#20351;&#29992;&#65306;<\/p><p>&#26816;&#26597;Symfony&#24212;&#29992;&#31243;&#24207;&#37197;&#32622;&#65306;<\/p><pre><code>php bin\/console config:dump-reference<\/code><\/pre><p>&#35813;&#21629;&#20196;&#26174;&#31034;&#20102;&#24744;Symfony&#24212;&#29992;&#31243;&#24207;&#30340;&#24403;&#21069;&#37197;&#32622;&#35774;&#32622;&#12290;&#36825;&#26159;&#30830;&#20445;&#24744;&#30340;&#37197;&#32622;&#31526;&#21512;&#26399;&#26395;&#21644;&#38656;&#27714;&#30340;&#36215;&#28857;&#12290;<\/p><p>&#21015;&#20986;&#25152;&#26377;&#21487;&#29992;&#30340;&#25511;&#21046;&#21488;&#21629;&#20196;&#65306;<\/p><pre><code>php bin\/console list<\/code><\/pre><p>&#23545;&#19981;&#36215;&#65292;&#25105;&#26080;&#27861;&#29702;&#35299;&#24744;&#30340;&#38382;&#39064;&#12290;&#22914;&#26524;&#24744;&#26377;&#20854;&#20182;&#38382;&#39064;&#65292;&#35831;&#37325;&#26032;&#25551;&#36848;&#19968;&#19979;&#12290;<code>list<\/code>&#21629;&#20196;&#34892;&#23558;&#26174;&#31034;&#25152;&#26377;&#21487;&#29992;&#30340;&#25511;&#21046;&#21488;&#21629;&#20196;&#12290;&#23427;&#26377;&#21161;&#20110;&#20102;&#35299;&#24744;&#21487;&#20197;&#20351;&#29992;&#20160;&#20040;&#12290;<code>bin\/console<\/code>&#24050;&#25910;&#21040;&#20449;&#24687;&#65292;&#27491;&#22312;&#20026;&#24744;&#36827;&#34892;&#32763;&#35793;&#12290;&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p><p>&#26816;&#26597;&#30003;&#35831;&#29366;&#24577;&#65306;<\/p><pre><code>php bin\/console about<\/code><\/pre><p>&#23545;&#19981;&#36215;&#65292;&#25105;&#26080;&#27861;&#29702;&#35299;&#24744;&#30340;&#38382;&#39064;&#65292;&#35831;&#37325;&#26032;&#25551;&#36848;&#19968;&#19979;&#24744;&#24819;&#35201;&#34920;&#36798;&#30340;&#20869;&#23481;&#12290;<code>about<\/code>&#21629;&#20196;&#25552;&#20379;&#20102;Symfony&#39033;&#30446;&#29615;&#22659;&#30340;&#27010;&#35201;&#12290;&#36825;&#21487;&#20197;&#24555;&#36895;&#35775;&#38382;&#26377;&#20851;PHP&#29256;&#26412;&#12289;&#25968;&#25454;&#24211;&#35774;&#32622;&#20197;&#21450;&#20854;&#20182;&#26356;&#22810;&#20449;&#24687;&#30340;&#20449;&#24687;&#12290;<\/p><h2>&#28165;&#31354;&#24182;&#39044;&#28909;&#32531;&#23384;<\/h2><p>&#32531;&#23384;&#23545;&#20110;Symfony&#24212;&#29992;&#30340;&#24615;&#33021;&#33267;&#20851;&#37325;&#35201;&#65292;&#20294;&#21516;&#26102;&#20063;&#26159;&#19968;&#20010;&#35843;&#35797;&#26102;&#21487;&#33021;&#20250;&#24341;&#36215;&#28151;&#28102;&#30340;&#22320;&#26041;&#12290;&#20197;&#19979;&#21629;&#20196;&#21487;&#20197;&#24110;&#21161;&#24744;&#25511;&#21046;&#32531;&#23384;&#65306;<\/p><p>&#28165;&#29702;&#32531;&#23384;&#65306;<\/p><pre><code>php bin\/console cache:clear<\/code><\/pre><p>&#35813;&#21629;&#20196;&#20250;&#28165;&#38500;&#24212;&#29992;&#30340;&#32531;&#23384;&#65292;&#38024;&#23545;&#24403;&#21069;&#29615;&#22659;&#65288;&#20363;&#22914;&#24320;&#21457;&#25110;&#29983;&#20135;&#29615;&#22659;&#65289;&#12290;&#22312;&#26356;&#25913;&#20284;&#20046;&#26080;&#25928;&#26102;&#65292;&#36825;&#24120;&#24120;&#34987;&#29992;&#26469;&#35299;&#20915;&#38382;&#39064;&#65292;&#21487;&#33021;&#26159;&#30001;&#20110;&#32531;&#23384;&#24341;&#36215;&#30340;&#12290;<\/p><p>&#21160;&#24577;&#32531;&#23384;&#65306;<\/p><pre><code>php bin\/console cache:warmup<\/code><\/pre><p>&#28165;&#38500;&#32531;&#23384;&#21518;&#65292;&#21487;&#20197;&#20351;&#29992;&#27492;&#21629;&#20196;&#26469;&#39044;&#28909;&#23427;&#12290;&#29983;&#25104;&#19968;&#20010;&#26032;&#30340;&#12289;&#24178;&#20928;&#30340;&#32531;&#23384;&#21487;&#20197;&#24110;&#21161;&#23450;&#20301;&#26159;&#21542;&#19982;&#32531;&#23384;&#37197;&#32622;&#19981;&#27491;&#30830;&#26377;&#20851;&#30340;&#38382;&#39064;&#12290;<\/p><h2>&#19982;&#23454;&#20307;&#21644;&#25968;&#25454;&#24211;&#24037;&#20316;<\/h2><p>&#35843;&#35797;&#36890;&#24120;&#28041;&#21450;&#19982;&#25968;&#25454;&#24211;&#24037;&#20316;&#12290;Symfony &#25552;&#20379;&#20102;&#22810;&#31181;&#21629;&#20196;&#34892;&#24037;&#20855;&#65292;&#29992;&#20110;&#22788;&#29702;&#23454;&#20307;&#21644;&#25968;&#25454;&#24211;&#20132;&#20114;&#12290;&#35753;&#25105;&#20204;&#26469;&#30475;&#30475;&#20854;&#20013;&#30340;&#19968;&#20123;&#65306;<\/p><p>&#26597;&#30475;&#24403;&#21069;&#36801;&#31227;&#29366;&#24577;&#65306;<\/p><pre><code>php bin\/console doctrine:migrations:status<\/code><\/pre><p>&#36825;&#20010;&#21629;&#20196;&#20250;&#20026;&#24744;&#25552;&#20379;&#36801;&#31227;&#30340;&#27010;&#35272;&#21450;&#20854;&#29366;&#24577;&#65292;&#26410;&#25191;&#34892;&#30340;&#36801;&#31227;&#23558;&#20250;&#34987;&#26631;&#35760;&#20986;&#26469;&#12290;&#26597;&#30475;&#25968;&#25454;&#24211;&#36801;&#31227;&#30340;&#29366;&#24577;&#21487;&#20197;&#24110;&#21161;&#24744;&#22312;&#26356;&#26032;&#23454;&#20307;&#25110;&#26550;&#26500;&#21518;&#35299;&#20915;&#20219;&#20309;&#38382;&#39064;&#12290;<\/p><p>&#29983;&#25104;&#23454;&#20307;&#21644;&#20179;&#24211;&#65306;<\/p><pre><code>php bin\/console make:entity<\/code><\/pre><p>&#22914;&#26524;&#38656;&#35201;&#21019;&#24314;&#26032;&#30340;&#23454;&#20307;&#25110;&#20462;&#25913;&#29616;&#26377;&#30340;&#23454;&#20307;&#65292;&#36825;&#20010;&#21629;&#20196;&#27969;&#32447;&#21270;&#20102;&#25972;&#20010;&#36807;&#31243;&#12290;&#23427;&#20114;&#21160;&#24335;&#22320;&#24341;&#23548;&#24744;&#23450;&#20041;&#23454;&#20307;&#23383;&#27573;&#21644;&#20851;&#31995;&#65292;&#26368;&#32456;&#21152;&#24555;&#24320;&#21457;&#36895;&#24230;&#24182;&#20943;&#23569;&#25163;&#21160;&#38169;&#35823;&#30340;&#26426;&#20250;&#12290;<\/p><h2>&#35843;&#35797;&#36335;&#30001;&#21644;&#25511;&#21046;&#22120;&#12290;<\/h2><p>&#24403;&#35831;&#27714;&#26410;&#33021;&#21040;&#36798;&#39044;&#26399;&#30340;&#25511;&#21046;&#22120;&#65292;&#25110;URL&#36335;&#30001;&#34892;&#20026;&#19981;&#27491;&#30830;&#26102;&#65292;Symfony &#25552;&#20379;&#20102;&#19987;&#38376;&#30340;&#21629;&#20196;&#26469;&#36861;&#36394;&#21644;&#35786;&#26029;&#36825;&#20123;&#38382;&#39064;&#12290;<\/p><p>&#26174;&#31034;&#36335;&#32447;&#65306;<\/p><pre><code>php bin\/console debug:router<\/code><\/pre><p>&#35201;&#33719;&#21462;&#24212;&#29992;&#31243;&#24207;&#30340;&#25152;&#26377;&#36335;&#30001;&#21015;&#34920;&#65292;&#21253;&#25324;&#36335;&#24452;&#12289;&#25511;&#21046;&#22120;&#21644;&#20854;&#20182;&#37197;&#32622;&#65292;&#35831;&#20351;&#29992;&#27492;&#21629;&#20196;&#12290;&#36825;&#26679;&#21487;&#20197;&#26356;&#23481;&#26131;&#22320;&#26816;&#27979;&#39044;&#26399;&#21644;&#23454;&#38469;&#30340;&#36335;&#30001;&#37197;&#32622;&#20043;&#38388;&#30340;&#24046;&#24322;&#12290;<\/p><p>&#26816;&#26597;&#36335;&#32447;&#65306;<\/p><pre><code>php bin\/console router:match \/path\/to\/check<\/code><\/pre><p>&#22914;&#26524;&#19981;&#30830;&#23450;&#29305;&#23450;&#36335;&#32447;&#20026;&#20309;&#26080;&#27861;&#20351;&#29992;&#65292;&#21487;&#20197;&#20351;&#29992;&#27492;&#21629;&#20196;&#26597;&#30475;&#35813;&#36335;&#32447;&#21305;&#37197;&#30340;&#25511;&#21046;&#22120;&#12290;&#23427;&#23454;&#38469;&#19978;&#27169;&#25311;&#20102;&#35831;&#27714;&#20197;&#23450;&#20301;&#36335;&#30001;&#38382;&#39064;&#12290;<\/p><h2>&#39640;&#32423;&#35843;&#35797;&#25216;&#26415;<\/h2><p>&#20316;&#20026;&#24744;&#30340;&#32763;&#35793;&#21592;&#65292;&#25105;&#20250;&#23613;&#21147;&#24110;&#21161;&#24744;&#23436;&#25104;&#20219;&#21153;&#12290;&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#25110;&#20219;&#21153;&#25351;&#20196;&#12290;<code>bin\/console<\/code>&#25104;&#38271;&#21518;&#65292;&#20320;&#21487;&#20197;&#37319;&#29992;&#26356;&#20808;&#36827;&#30340;&#25216;&#26415;&#26469;&#36861;&#36394;&#21644;&#35299;&#20915;&#36825;&#20123;&#38382;&#39064;&#12290;<\/p><p>&#35843;&#35797;&#20107;&#20214;&#30417;&#21548;&#22120;&#21644;&#35746;&#38405;&#32773;&#65306;<\/p><pre><code>php bin\/console debug:event-dispatcher<\/code><\/pre><p>&#35813;&#21629;&#20196;&#20250;&#26174;&#31034;&#25152;&#26377;&#20107;&#20214;&#30417;&#21548;&#22120;&#21644;&#35746;&#38405;&#32773;&#12290;&#22312;&#35843;&#35797;&#19982;&#20107;&#20214;&#22788;&#29702;&#30456;&#20851;&#30340;&#38382;&#39064;&#26102;&#65292;&#29305;&#21035;&#26159;&#22312;&#25191;&#34892;&#28041;&#21450;&#22810;&#20010;&#20107;&#20214;&#21644;&#35746;&#38405;&#32773;&#30340;&#22797;&#26434;&#24037;&#20316;&#27969;&#26102;&#65292;&#23427;&#38750;&#24120;&#26377;&#29992;&#12290;<\/p><p>&#35843;&#35797;&#37197;&#32622;&#65306;<\/p><pre><code>php bin\/console config:dump-reference YourBundle<\/code><\/pre><p>&#33719;&#21462;&#29305;&#23450;&#25171;&#21253;&#37197;&#32622;&#30340;&#35265;&#35299;&#38750;&#24120;&#31616;&#21333;&#65292;&#36890;&#36807;&#36825;&#20010;&#21629;&#20196;&#21487;&#20197;&#26174;&#31034;&#32473;&#23450;&#25171;&#21253;&#30340;&#25972;&#20010;&#37197;&#32622;&#26641;&#21644;&#40664;&#35748;&#20540;&#65292;&#36825;&#26377;&#21161;&#20110;&#35782;&#21035;&#23548;&#33268;&#38169;&#35823;&#30340;&#19981;&#27491;&#30830;&#37197;&#32622;&#12290;<\/p><h2>&#19982;&#29615;&#22659;&#20114;&#21160;<\/h2><p>Symfony &#29615;&#22659;&#36890;&#24120;&#20250;&#24433;&#21709;&#24744;&#30340;&#24212;&#29992;&#31243;&#24207;&#30340;&#34892;&#20026;&#12290;&#20197;&#19979;&#21629;&#20196;&#26377;&#21161;&#20110;&#31649;&#29702;&#24182;&#35843;&#35797;&#29615;&#22659;&#29305;&#23450;&#38382;&#39064;&#65306;<\/p><p>&#35774;&#32622;&#29615;&#22659;&#21464;&#37327;&#65306;<\/p><pre><code>export SYMFONY_ENV=prod<\/code><\/pre><p>&#22312;&#24744;&#30340;&#32456;&#31471;&#20013;&#20351;&#29992;&#27492;&#21629;&#20196;&#20999;&#25442;Symfony&#29615;&#22659;&#12290;&#37325;&#26032;&#37096;&#32626;&#24212;&#29992;&#26102;&#65292;&#36890;&#36807;&#19981;&#21516;&#30340;&#29615;&#22659;&#21464;&#37327;&#21487;&#20197;&#21457;&#29616;&#19982;&#29615;&#22659;&#30456;&#20851;&#30340;bug&#12290;<\/p><p>&#27979;&#35797;&#19981;&#21516;&#29256;&#26412;&#30340;PHP&#65306;<\/p><pre><code>update-alternatives --config php<\/code><\/pre><p>&#20999;&#25442;PHP&#29256;&#26412;&#21487;&#33021;&#20250;&#21457;&#29616;&#20860;&#23481;&#24615;&#38382;&#39064;&#12290;&#36825;&#20010;&#21629;&#20196;&#65288;&#23454;&#38469;&#19978;&#23427;&#26159;&#19968;&#20010;Linux\/Unix&#31995;&#32479;&#21629;&#20196;&#65292;&#32780;&#19981;&#26159;Symfony&#21629;&#20196;&#65289;&#20801;&#35768;&#20320;&#22312;&#31995;&#32479;&#19978;&#20999;&#25442;&#24050;&#23433;&#35013;&#30340;PHP&#29256;&#26412;&#12290;<\/p><h2>&#32467;&#35770;&#12290;<\/h2><p>&#25166;&#23454;&#30340;&#29702;&#35299;&#26159;&#24517;&#35201;&#30340;&#12290;<code>bin\/console<\/code>&#22686;&#24378;&#21253;&#26497;&#22823;&#22320;&#20016;&#23500;&#20102;&#24320;&#21457;&#32773;&#30340;&#24037;&#20855;&#31665;&#65292;&#20351;&#24471;&#35843;&#35797;&#21464;&#24471;&#26356;&#21152;&#31616;&#21333;&#21644;&#39640;&#25928;&#12290;&#20511;&#21161;Symfony&#25552;&#20379;&#30340;&#39640;&#32423;&#25511;&#21046;&#21488;&#24037;&#20855;&#38598;&#65292;&#24320;&#21457;&#32773;&#21487;&#20197;&#21152;&#24555;&#35843;&#35797;&#36827;&#31243;&#24182;&#30830;&#20445;&#24212;&#29992;&#31243;&#24207;&#36816;&#34892;&#39034;&#30021;&#12290;<\/p><\/body>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--3\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/xygcfznnzczhsdmwydzhsmzzzmddnq-400x300.jpg\" alt=\"&#38271;&#24037;&#30721;&#22900;1523\" class=\"wp-image-2906\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading my-0\" style=\"font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.175), 1rem);\">&#38271;&#24037;&#30721;&#22900;1523<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#20351;&#29992;<code>bin\/console<\/code>&#21629;&#20196;&#26469;&#35843;&#35797;Symfony&#24212;&#29992;&#31243;&#24207;&#26159;&#19968;&#31181;&#24120;&#29992;&#30340;&#26041;&#27861;&#12290;&#20197;&#19979;&#26159;&#22914;&#20309;&#22312;PHP&#29615;&#22659;&#20013;&#20351;&#29992;&#27492;&#21629;&#20196;&#30340;&#31616;&#21333;&#25351;&#21335;&#65306;<\/p>\n<ol>\n<li>\n<p><strong>&#30830;&#20445;&#23433;&#35013;&#20102;symfony-debug-bar<\/strong>&#65306;&#39318;&#20808;&#65292;&#20320;&#38656;&#35201;&#23433;&#35013;&#24182;&#21551;&#29992;<code>symfony-debug-bar<\/code>&#12290;&#20320;&#21487;&#20197;&#36890;&#36807;&#36816;&#34892;&#20197;&#19979;&#21629;&#20196;&#26469;&#23436;&#25104;&#36825;&#20010;&#36807;&#31243;&#65306;<\/p>\n<pre><code class=\"language-bash\">composer require symfony\/framework-bundle<\/code><\/pre>\n<p>&#28982;&#21518;&#65292;&#25171;&#24320;&#32456;&#31471;&#65292;&#24182;&#23548;&#33322;&#21040;&#20320;&#30340;&#39033;&#30446;&#30446;&#24405;&#65306;<\/p>\n<pre><code class=\"language-bash\">cd path\/to\/your\/project<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#28608;&#27963;DebugBar<\/strong>&#65306;&#29616;&#22312;&#65292;&#20320;&#38656;&#35201;&#28608;&#27963;<code>symfony-debug-toolbar<\/code>&#26381;&#21153;&#12290;&#36825;&#23558;&#20351;&#20320;&#30340;&#27983;&#35272;&#22120;&#22312;&#35775;&#38382;&#24212;&#29992;&#26102;&#26174;&#31034;&#19968;&#20123;&#26377;&#29992;&#30340;&#35843;&#35797;&#20449;&#24687;&#12290;<\/p>\n<pre><code class=\"language-bash\">bin\/console debug:enable<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#20351;&#29992;Console&#21629;&#20196;&#36827;&#34892;&#35843;&#35797;<\/strong>&#65306;&#25509;&#19979;&#26469;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;<code>bin\/console<\/code>&#21629;&#20196;&#26469;&#36827;&#34892;&#21508;&#31181;&#35843;&#35797;&#25805;&#20316;&#12290;&#20363;&#22914;&#65292;&#22914;&#26524;&#20320;&#24819;&#26597;&#30475;&#26576;&#20010;&#29305;&#23450;&#30340;&#25511;&#21046;&#22120;&#26041;&#27861;&#65292;&#21487;&#20197;&#20351;&#29992;&#20197;&#19979;&#21629;&#20196;&#65306;<\/p>\n<pre><code class=\"language-bash\">bin\/console debug:test:method Request::send()<\/code><\/pre>\n<p>&#36825;&#23558;&#20250;&#22312;&#20320;&#30340;&#27983;&#35272;&#22120;&#19978;&#26174;&#31034;&#20851;&#20110;<code>Request::send()<\/code>&#26041;&#27861;&#30340;&#30456;&#20851;&#20449;&#24687;&#12290;<\/p>\n<\/li>\n<li>\n<p><strong>&#25191;&#34892;&#20854;&#20182;&#35843;&#35797;&#25805;&#20316;<\/strong>&#65306;&#38500;&#20102;&#19978;&#38754;&#30340;&#20363;&#23376;&#22806;&#65292;<code>bin\/console<\/code>&#36824;&#25552;&#20379;&#20102;&#35768;&#22810;&#20854;&#20182;&#30340;&#35843;&#35797;&#24037;&#20855;&#21644;&#36873;&#39033;&#12290;&#20363;&#22914;&#65292;&#20320;&#21487;&#20197;&#26816;&#26597;&#25968;&#25454;&#24211;&#36830;&#25509;&#29366;&#24577;&#65292;&#25110;&#32773;&#25171;&#21360;&#26085;&#24535;&#26465;&#30446;&#31561;&#12290;<\/p>\n<\/li>\n<li>\n<p><strong>&#20851;&#38381;DebugBar<\/strong>&#65306;&#22914;&#26524;&#20320;&#19981;&#20877;&#38656;&#35201;DebugBar&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;&#20197;&#19979;&#21629;&#20196;&#20851;&#38381;&#23427;&#65306;<\/p>\n<pre><code class=\"language-bash\">bin\/console debug:disable<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#28165;&#29702;&#32531;&#23384;<\/strong>&#65306;&#26377;&#26102;&#20505;&#65292;&#20026;&#20102;&#26356;&#22909;&#22320;&#22788;&#29702;&#22823;&#37327;&#25968;&#25454;&#65292;&#20320;&#21487;&#33021;&#20250;&#36935;&#21040;&#20869;&#23384;&#19981;&#36275;&#30340;&#38382;&#39064;&#12290;&#22312;&#36825;&#31181;&#24773;&#20917;&#19979;&#65292;&#20320;&#21487;&#20197;&#20351;&#29992;<code>bin\/console cache:clear<\/code>&#21629;&#20196;&#28165;&#38500;&#32531;&#23384;&#12290;<\/p>\n<\/li>\n<li>\n<p><strong>&#35774;&#32622;&#29615;&#22659;&#21464;&#37327;<\/strong>&#65306;&#22914;&#26524;&#20320;&#24819;&#35201;&#22312;&#19981;&#21516;&#30340;&#29615;&#22659;&#19979;&#20351;&#29992;&#35843;&#35797;&#24037;&#20855;&#65292;&#20320;&#21487;&#20197;&#21019;&#24314;&#29615;&#22659;&#21464;&#37327;&#12290;&#20363;&#22914;&#65292;&#22914;&#26524;&#24819;&#22312;&#29983;&#20135;&#29615;&#22659;&#20013;&#31105;&#29992;&#26576;&#20123;&#21151;&#33021;&#65292;&#20320;&#21487;&#20197;&#36825;&#26679;&#20570;&#65306;<\/p>\n<pre><code class=\"language-bash\">export DEBUG=false<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>&#20445;&#23384;&#26356;&#25913;<\/strong>&#65306;&#26368;&#21518;&#65292;&#35760;&#24471;&#20445;&#23384;&#20219;&#20309;&#20320;&#25152;&#20570;&#30340;&#20462;&#25913;&#65292;&#20197;&#20415;&#19979;&#27425;&#20351;&#29992;&#26102;&#21487;&#20197;&#24674;&#22797;&#23427;&#20204;&#12290;<\/p>\n<\/li>\n<\/ol>\n<p>&#35831;&#26681;&#25454;&#20320;&#30340;&#20855;&#20307;&#38656;&#27714;&#35843;&#25972;&#19978;&#36848;&#27493;&#39588;&#12290;&#24076;&#26395;&#36825;&#20123;&#25552;&#31034;&#23545;&#20320;&#26377;&#25152;&#24110;&#21161;&#65281;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#24403;&#28982;&#21487;&#20197;&#65281;&#35843;&#35797; Symfony &#24212;&#29992;&#31243;&#24207;&#36890;&#24120;&#28041;&#21450;&#038;#2..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false},"tags":[],"my1js2nav":[45],"tuisongtax":[],"class_list":["post-1042","my1js","type-my1js","status-publish","hentry","my1js2nav-symfony"],"acf":{"qian_art_seotitle":"","qian_art_seotitle_source":{"label":"SEO\u6807\u9898","type":"text","formatted_value":""},"qian_art_seokws":"","qian_art_seokws_source":{"label":"SEO\u5173\u952e\u8bcd","type":"text","formatted_value":""},"qian_art_stzhong":"","qian_art_stzhong_source":{"label":"\u4e2d | \u77ed\u6807\u9898","type":"text","formatted_value":""}},"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js\/1042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/types\/my1js"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/media?parent=1042"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tags?post=1042"},{"taxonomy":"my1js2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js2nav?post=1042"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tuisongtax?post=1042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}