{"id":481,"date":"2025-06-10T21:05:27","date_gmt":"2025-06-10T13:05:27","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/php\/php-application-manual\/jcyy\/481.html"},"modified":"2025-06-10T21:05:27","modified_gmt":"2025-06-10T13:05:27","slug":"php%ef%bc%9a%e4%bd%bf%e7%94%a8docblock%e6%b3%a8%e9%87%8a%e6%9d%a5%e6%b3%a8%e9%87%8a%e5%8f%98%e9%87%8f","status":"publish","type":"my1js","link":"https:\/\/www.zhaozhao123.cn\/php\/my1js\/481.html","title":{"rendered":"PHP\uff1a\u4f7f\u7528DocBlock\u6ce8\u91ca\u6765\u6ce8\u91ca\u53d8\u91cf"},"content":{"rendered":"<p><body><\/p>\n<h2>&#20171;&#32461;<\/h2>\n<p>&#24403;&#20320;&#25552;&#21040;&#20351;&#20195;&#30721;&#26356;&#26131;&#20110;&#29702;&#35299;&#21644;&#32500;&#25252;&#26102;&#65292;&#36866;&#24403;&#30340;&#25991;&#26723;&#30830;&#23454;&#33267;&#20851;&#37325;&#35201;&#12290;PHP&#20316;&#20026;&#26368;&#21463;&#27426;&#36814;&#30340;&#26381;&#21153;&#22120;&#31471;&#32534;&#31243;&#35821;&#35328;&#20043;&#19968;&#65292;&#25903;&#25345;&#22810;&#31181;&#26041;&#24335;&#26469;&#27880;&#37322;&#20195;&#30721;&#12290;&#20854;&#20013;&#19968;&#31181;&#26041;&#27861;&#23601;&#26159;&#20351;&#29992;DocBlock&#27880;&#37322;&#26469;&#26631;&#27880;&#21464;&#37327;&#65292;&#36825;&#26497;&#22823;&#22320;&#25552;&#39640;&#20102;&#20195;&#30721;&#21487;&#35835;&#24615;&#65292;&#24182;&#24110;&#21161;&#24320;&#21457;&#32773;&#22312;&#22797;&#26434;&#20195;&#30721;&#24211;&#20013;&#23548;&#33322;&#12290;&#22312;&#36825;&#31687;&#25945;&#31243;&#20013;&#65292;&#25105;&#20204;&#23558;&#28145;&#20837;&#25506;&#35752;&#22914;&#20309;&#20351;&#29992;DocBlock&#27880;&#37322;&#26469;&#26631;&#27880;PHP&#20013;&#30340;&#21464;&#37327;&#65292;&#20174;&#22522;&#30784;&#21040;&#39640;&#32423;&#31034;&#20363;&#36880;&#27493;&#36827;&#34892;&#12290;<\/p>\n<h2>&#24320;&#22987;&#20351;&#29992;DocBlock<\/h2>\n<p>&#22312;&#25105;&#20204;&#28145;&#20837;&#25506;&#35752;&#31034;&#20363;&#20043;&#21069;&#65292;&#29702;&#35299;DocBlock&#27880;&#37322;&#33267;&#20851;&#37325;&#35201;&#12290;DocBlock&#27880;&#37322;&#65292;&#22312;PHP&#20013;&#32463;&#24120;&#20351;&#29992;&#65292;&#26159;&#19968;&#31181;&#29305;&#27530;&#30340;&#27880;&#37322;&#31867;&#22411;&#65292;&#21487;&#20197;&#21253;&#25324;&#25551;&#36848;&#20195;&#30721;&#20803;&#32032;&#34892;&#20026;&#25110;&#30446;&#30340;&#30340;&#27880;&#37322;&#65292;&#22914;&#21464;&#37327;&#12289;&#31867;&#12289;&#26041;&#27861;&#31561;&#12290;&#36825;&#20123;&#27880;&#37322;&#36890;&#36807;&#24037;&#20855;&#22914;phpDocumentor&#35299;&#26512;&#26469;&#29983;&#25104;&#33258;&#21160;&#25991;&#26723;&#12290;<\/p>\n<p>&#35201;&#24320;&#22987;&#20351;&#29992;DocBlock&#27880;&#37322;&#26469;&#22768;&#26126;&#21464;&#37327;&#65292;&#22522;&#26412;&#30340;&#35821;&#27861;&#22914;&#19979;&#65306;<\/p>\n<pre><code>\/**\n * @var DataType $variableName Description\n *\/\n<\/code><\/pre>\n<h2>&#22522;&#26412;&#31034;&#20363;<\/h2>\n<p>&#35753;&#25105;&#20204;&#20174;&#19968;&#20010;&#22522;&#26412;&#30340;&#20363;&#23376;&#24320;&#22987;&#65306;<\/p>\n<pre><code>\/**\n * @var string $greeting The greeting message\n *\/\n$greeting = 'Hello, World!';\n<\/code><\/pre>\n<p>&#36825;&#20010;&#31616;&#21333;&#30340;&#27880;&#37322;&#21578;&#35785;&#25105;&#20204;&#20102;&#12290;<code>$greeting<\/code>&#19968;&#20010;&#24102;&#26377;&#31616;&#35201;&#25551;&#36848;&#30340;&#23383;&#31526;&#20018;&#31867;&#22411;&#21464;&#37327;&#12290;&#34429;&#28982;&#31616;&#21333;&#65292;&#20294;&#23427;&#26497;&#22823;&#22320;&#26377;&#21161;&#20110;&#29702;&#35299;&#21464;&#37327;&#30340;&#30446;&#30340;&#12290;<\/p>\n<h2>&#27880;&#37322;&#30340;&#31867;&#22411;<\/h2>\n<p>&#38500;&#20102;&#25351;&#23450;&#21464;&#37327;&#30340;&#31867;&#22411;&#65292;DocBlock&#27880;&#37322;&#36824;&#21487;&#20197;&#21253;&#25324;&#21508;&#31181;&#31867;&#22411;&#30340;&#27880;&#35299;&#65292;&#22914;&#65306;<\/p>\n<p>@&#24050;&#24223;&#24323;&#65292;&#34920;&#31034;&#21464;&#37327;&#36807;&#26102;&#12290;<\/p>\n<p>&#35831;&#21442;&#38405;&#30456;&#20851;&#25991;&#26723;&#25110;&#20803;&#32032;&#30340;&#38142;&#25509;&#12290;<\/p>\n<p>&#35831;&#25351;&#23450;&#21464;&#37327;&#30340;&#31867;&#22411;&#12290;<\/p>\n<h2>&#39640;&#32423;&#31034;&#20363;<\/h2>\n<p>&#32487;&#32493;&#30475;&#26356;&#39640;&#32423;&#30340;&#20363;&#23376;&#65292;&#25105;&#20204;&#23558;&#30475;&#21040;&#22914;&#20309;&#27880;&#35299;&#25968;&#32452;&#12289;&#23545;&#35937;&#25110;&#20854;&#20182;&#22797;&#26434;&#30340;&#25968;&#25454;&#31867;&#22411;&#20013;&#30340;&#21464;&#37327;&#12290;<\/p>\n<h3>&#25968;&#32452;&#27880;&#35299;<\/h3>\n<pre><code>\/**\n * @var string[] $names List of names\n *\/\n$names = ['Alice', 'Bob', 'Charlie'];\n<\/code><\/pre>\n<p>&#36825;&#20010;&#27880;&#37322;&#28548;&#28165;&#20102;&#36825;&#19968;&#28857;&#12290;<code>$names<\/code>&#36825;&#26159;&#19968;&#20010;&#23383;&#31526;&#20018;&#25968;&#32452;&#12290;<\/p>\n<h3>&#23545;&#35937;&#26631;&#27880;<\/h3>\n<pre><code>\/**\n * @var User $user Instance of a User class\n *\/\n$user = new User('Alice', '1234');\n<\/code><\/pre>\n<p>&#22312;&#36825;&#37324;&#65292;&#25105;&#20204;&#27491;&#22312;&#27880;&#37322;&#12290;<code>$user<\/code>&#19968;&#20010;User&#31867;&#30340;&#23545;&#35937;&#65292;&#25552;&#20379;&#21464;&#37327;&#30340;&#26356;&#22810;&#19978;&#19979;&#25991;&#35299;&#37322;&#12290;<\/p>\n<h3>&#22797;&#26434;&#25968;&#25454;&#31867;&#22411;<\/h3>\n<p>&#23545;&#20110;&#25345;&#26377;&#22797;&#26434;&#25968;&#25454;&#31867;&#22411;&#65288;&#22914;&#22810;&#32500;&#25968;&#32452;&#25110;&#38598;&#21512;&#65289;&#30340;&#21464;&#37327;&#65292;DocBlock&#27880;&#37322;&#23588;&#20854;&#26377;&#24110;&#21161;&#65306;<\/p>\n<pre><code>\/**\n * @var array $userInfo Collection of user information\n *\/\n$userInfo = [\n    'name' =&gt; 'Alice',\n    'password' =&gt; 'secret',\n    'roles' =&gt; ['admin', 'user']\n];\n<\/code><\/pre>\n<p>&#36825;&#20010;&#20363;&#23376;&#34920;&#26126;&#20102;&#12290;<code>$userInfo<\/code>&#26159;&#19968;&#20010;&#20851;&#32852;&#25968;&#32452;&#65292;&#29992;&#20110;&#23384;&#20648;&#29992;&#25143;&#20449;&#24687;&#30340;&#38598;&#21512;&#12290;<\/p>\n<h2>&#29983;&#25104;&#25991;&#26723;&#30340;&#24037;&#20855;<\/h2>\n<p>&#32534;&#20889;DocBlock&#27880;&#37322;&#21482;&#26159;&#21322;&#31243;&#32988;&#21033;&#65292;&#35201;&#30495;&#27491;&#21457;&#25381;&#36825;&#20123;&#27880;&#37322;&#30340;&#20316;&#29992;&#65292;&#20320;&#24212;&#35813;&#21033;&#29992;&#20687;phpDocumentor&#36825;&#26679;&#30340;&#24037;&#20855;&#65292;&#23427;&#20204;&#21487;&#20197;&#26681;&#25454;&#20320;&#30340;&#27880;&#37322;&#33258;&#21160;&#29983;&#25104;&#19987;&#19994;&#25991;&#26723;&#12290;&#36825;&#20123;&#24037;&#20855;&#35299;&#26512;DocBlock&#27880;&#37322;&#24182;&#21019;&#24314;&#26082;&#23545;&#24320;&#21457;&#20154;&#21592;&#26377;&#29992;&#21448;&#36866;&#21512;&#26368;&#32456;&#29992;&#25143;&#25110;API&#28040;&#36153;&#32773;&#30340;&#25991;&#26723;&#12290;<\/p>\n<h2>&#26368;&#20339;&#23454;&#36341;<\/h2>\n<p>&#22312;&#24744;&#30340;&#32534;&#30721;&#23454;&#36341;&#20013;&#24341;&#20837;DocBlock&#27880;&#37322;&#38656;&#35201;&#36981;&#24490;&#19968;&#20123;&#26368;&#20339;&#23454;&#36341;&#65306;<\/p>\n<p>&#20351;&#29992;&#36866;&#24403;&#30340;&#31867;&#22411;&#27880;&#35299;&#65292;&#29305;&#21035;&#26159;&#22312;&#22788;&#29702;&#22797;&#26434;&#25110;&#33258;&#23450;&#20041;&#25968;&#25454;&#31867;&#22411;&#26102;&#12290;<\/p>\n<p>&#30830;&#20445;&#24744;&#30340;&#35780;&#35770;&#19982;&#20195;&#30721;&#20445;&#25345;&#21516;&#27493;&#12290;<\/p>\n<p>&#22909;&#30340;&#65292;&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p>\n<h2>&#32467;&#35770;&#12290;<\/h2>\n<p>DocBlock&#27880;&#37322;&#36890;&#36807;&#30830;&#20445;&#20195;&#30721;&#25991;&#26723;&#21270;&#21644;&#21487;&#32500;&#25252;&#24615;&#65292;&#20026;PHP&#24320;&#21457;&#22686;&#33394;&#19981;&#23569;&#12290;&#37319;&#29992;&#36825;&#31181;&#20570;&#27861;&#19981;&#20165;&#24110;&#21161;&#26410;&#26469;&#30340;&#33258;&#24049;&#36827;&#34892;&#20195;&#30721;&#31649;&#29702;&#65292;&#36824;&#35753;&#22242;&#38431;&#25104;&#21592;&#33021;&#22815;&#26356;&#22909;&#22320;&#29702;&#35299;&#21644;&#23548;&#33322;&#20195;&#30721;&#24211;&#12290;&#35760;&#20303;&#65292;&#39640;&#36136;&#37327;&#30340;&#25991;&#26723;&#21270;&#30340;&#20195;&#30721;&#21516;&#26679;&#37325;&#35201;&#65292;&#29978;&#33267;&#27604;&#39640;&#36136;&#37327;&#30340;&#20195;&#30721;&#26356;&#37325;&#35201;&#12290;<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#20171;&#32461; &#24403;&#20320;&#25552;&#21040;&#20351;&#20195;&#30721;&#26356;&#26131;&#20110;&#29702;&#35299;&#21644;&#32500;&#25252;&#26102;&#65292;&#038;#36866..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false},"tags":[],"my1js2nav":[38],"tuisongtax":[],"class_list":["post-481","my1js","type-my1js","status-publish","hentry","my1js2nav-jcyy"],"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\/481","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=481"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tags?post=481"},{"taxonomy":"my1js2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js2nav?post=481"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tuisongtax?post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}