{"id":423,"date":"2025-06-10T20:14:33","date_gmt":"2025-06-10T12:14:33","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/php\/php-application-manual\/jcyy\/423.html"},"modified":"2025-06-10T20:14:33","modified_gmt":"2025-06-10T12:14:33","slug":"php-%e5%ae%9a%e4%b9%89%e8%bf%94%e5%9b%9e%e5%a4%9a%e4%b8%aa%e5%80%bc%e7%9a%84%e5%87%bd%e6%95%b0%ef%bc%883%e7%a7%8d%e6%96%b9%e6%b3%95%ef%bc%89","status":"publish","type":"my1js","link":"https:\/\/www.zhaozhao123.cn\/php\/my1js\/423.html","title":{"rendered":"PHP: \u5b9a\u4e49\u8fd4\u56de\u591a\u4e2a\u503c\u7684\u51fd\u6570\uff083\u79cd\u65b9\u6cd5\uff09"},"content":{"rendered":"<p><body><\/p>\n<h2>&#27010;&#35272;<\/h2>\n<p>PHP &#26159;&#19968;&#31181;&#24191;&#27867;&#29992;&#20110;&#32593;&#39029;&#24320;&#21457;&#30340;&#26381;&#21153;&#22120;&#31471;&#33050;&#26412;&#35821;&#35328;&#12290;PHP &#30340;&#19968;&#20010;&#20248;&#21183;&#22312;&#20110;&#20854;&#31616;&#21333;&#24615;&#21644;&#26131;&#29992;&#24615;&#65292;&#29305;&#21035;&#26159;&#22312;&#22788;&#29702;&#20989;&#25968;&#26102;&#12290;&#22312;&#26412;&#25945;&#31243;&#20013;&#65292;&#25105;&#20204;&#23558;&#25506;&#35752; PHP &#20013;&#23450;&#20041;&#21487;&#20197;&#36820;&#22238;&#22810;&#20010;&#20540;&#30340;&#20989;&#25968;&#36825;&#19968;&#26356;&#39640;&#32423;&#30340;&#20027;&#39064;&#12290;<\/p>\n<p>&#29702;&#35299;&#22914;&#20309;&#22312;PHP&#20989;&#25968;&#20013;&#36820;&#22238;&#22810;&#20010;&#20540;&#26159;&#38750;&#24120;&#26377;&#29992;&#30340;&#65292;&#22312;&#38656;&#35201;&#25191;&#34892;&#19968;&#31995;&#21015;&#35745;&#31639;&#25110;&#19968;&#27425;&#24615;&#33719;&#21462;&#20960;&#20010;&#25968;&#25454;&#28857;&#30340;&#22330;&#26223;&#19979;&#65292;&#36991;&#20813;&#35843;&#29992;&#22810;&#20010;&#20989;&#25968;&#12290;&#23427;&#31616;&#21270;&#20102;&#20195;&#30721;&#24182;&#21487;&#20197;&#20351;&#32500;&#25252;&#21644;&#29702;&#35299;&#26356;&#31616;&#21333;&#12290;<\/p>\n<h2>&#29702;&#35299;&#22522;&#30784;&#27010;&#24565;<\/h2>\n<p>&#22312;&#28145;&#20837;&#25506;&#35752;PHP&#20989;&#25968;&#30340;&#22810;&#20219;&#21153;&#29305;&#24615;&#20043;&#21069;&#65292;&#35753;&#25105;&#20204;&#20808;&#22238;&#39038;&#19968;&#19979;PHP&#20989;&#25968;&#30340;&#22522;&#26412;&#27010;&#24565;&#12290;&#19968;&#20010;&#20989;&#25968;&#26159;&#19968;&#27573;&#21487;&#20197;&#37325;&#22797;&#20351;&#29992;&#30340;&#20195;&#30721;&#22359;&#65292;&#21487;&#20197;&#22312;&#33050;&#26412;&#30340;&#20854;&#20182;&#37096;&#20998;&#35843;&#29992;&#20197;&#25191;&#34892;&#29305;&#23450;&#30340;&#20219;&#21153;&#12290;&#26631;&#20934;PHP&#20989;&#25968;&#20351;&#29992;&#36820;&#22238;&#20540;&#26469;&#23436;&#25104;&#23427;&#20204;&#30340;&#21151;&#33021;&#12290;<code>return<\/code>&#38472;&#36848;&#12290;&#20294;&#26159;&#65292;PHP &#26412;&#36523;&#24182;&#19981;&#25903;&#25345;&#30452;&#25509;&#36820;&#22238;&#22810;&#20010;&#20540;&#12290;&#25105;&#20204;&#36890;&#24120;&#20351;&#29992;&#25968;&#32452;&#25110;&#23545;&#35937;&#26469;&#27169;&#25311;&#36825;&#31181;&#34892;&#20026;&#12290;<\/p>\n<h2>&#26041;&#27861;1&#65306;&#36820;&#22238;&#19968;&#20010;&#25968;&#32452;<\/h2>\n<p>&#36820;&#22238;PHP&#20989;&#25968;&#22810;&#20010;&#20540;&#30340;&#26368;&#31616;&#21333;&#26041;&#27861;&#26159;&#20351;&#29992;&#25968;&#32452;&#12290;&#24403;&#24744;&#30340;&#20989;&#25968;&#25191;&#34892;&#21508;&#31181;&#25805;&#20316;&#24182;&#38656;&#35201;&#36820;&#22238;&#22810;&#20010;&#32467;&#26524;&#26102;&#65292;&#24744;&#21482;&#38656;&#23558;&#32467;&#26524;&#25918;&#20837;&#25968;&#32452;&#20013;&#24182;&#36820;&#22238;&#35813;&#25968;&#32452;&#12290;<\/p>\n<p>&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p>\n<pre><code>function calculateDimensions($length, $width, $height) {\n  $volume = $length * $width * $height;\n  $surfaceArea = 2 * ($length * $width + $width * $height + $height * $length);\n\n  return array('volume' =&gt; $volume, 'surfaceArea' =&gt; $surfaceArea);\n}\n\n\/\/ Using the function\n$dimensions = calculateDimensions(5, 3, 2);\necho 'Volume: ' . $dimensions['volume'];\necho 'Surface area: ' . $dimensions['surfaceArea'];\n<\/code><\/pre>\n<p>&#36825;&#20010;&#20363;&#23376;&#23450;&#20041;&#20102;&#19968;&#20010;&#20989;&#25968;&#12290;<code>calculateDimensions<\/code>&#35813;&#20844;&#24335;&#35745;&#31639;&#24182;&#36820;&#22238;&#38271;&#26041;&#20307;&#30340;&#20307;&#31215;&#21644;&#34920;&#38754;&#31215;&#12290;<\/p>\n<h2>&#26041;&#27861;2&#65306;&#20351;&#29992;list()&#25552;&#21462;&#20540;<\/h2>\n<p>PHP &#25552;&#20379;&#20102;&#19968;&#20010;&#26041;&#20415;&#30340;&#20989;&#25968;&#21517;&#20026;<code>list()<\/code>&#36825;&#26679;&#65292;&#20320;&#21487;&#20197;&#22312;&#19968;&#20010;&#25805;&#20316;&#20013;&#20026;&#25968;&#32452;&#20013;&#30340;&#20803;&#32032;&#20998;&#37197;&#21464;&#37327;&#12290;&#24403;&#20320;&#22312;&#20989;&#25968;&#36820;&#22238;&#19968;&#20010;&#25968;&#32452;&#26102;&#24037;&#20316;&#26102;&#65292;&#36825;&#21487;&#20197;&#20351;&#20195;&#30721;&#26356;&#24178;&#20928;&#12290;<\/p>\n<p>&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p>\n<pre><code>list($volume, $surfaceArea) = calculateDimensions(5, 3, 2);\necho 'Volume: ' . $volume;\necho 'Surface area: ' . $surfaceArea;\n<\/code><\/pre>\n<p>&#20351;&#29992;<code>list()<\/code>, the values returned by<code>calculateDimensions<\/code>&#31435;&#21363;&#34987;&#20998;&#37197;&#21040;<code>$volume<\/code>and &#26159;&ldquo;&#21644;&rdquo;&#30340;&#24847;&#24605;&#12290;<code>$surfaceArea<\/code>&#22909;&#30340;&#65292;&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p>\n<h2>&#26041;&#27861; 3&#65306;&#36820;&#22238;&#19968;&#20010;&#23545;&#35937;<\/h2>\n<p>&#22914;&#26524;&#20320;&#24819;&#36820;&#22238;&#19982;&#24444;&#27492;&#30456;&#20851;&#30340;&#22810;&#20010;&#20540;&#65292;&#21487;&#20197;&#32771;&#34385;&#20174;&#20989;&#25968;&#20013;&#36820;&#22238;&#19968;&#20010;&#23545;&#35937;&#12290;&#29305;&#21035;&#26159;&#22914;&#26524;&#36825;&#20123;&#20540;&#20195;&#34920;&#21516;&#19968;&#20010;&#27010;&#24565;&#30340;&#23646;&#24615;&#12290;<\/p>\n<p>&#35831;&#25552;&#20379;&#38656;&#35201;&#32763;&#35793;&#30340;&#20869;&#23481;&#12290;<\/p>\n<pre><code>function calculateDimensions($length, $width, $height) {\n  $result = new stdClass();\n  $result-&gt;volume = $length * $width * $height;\n  $result-&gt;surfaceArea = 2 * ($length * $width + $width * $height + $height * $length);\n\n  return $result;\n}\n\n\/\/ Using the function\n$dimensions = calculateDimensions(5, 3, 2);\necho 'Volume: ' . $dimensions-&gt;volume;\necho 'Surface area: ' . $dimensions-&gt;surfaceArea;\n<\/code><\/pre>\n<p><code>stdClass<\/code>&#22312;PHP&#20013;&#65292;&#26377;&#19968;&#20010;&#36890;&#29992;&#30340;&#31354;&#31867;&#65288;empty class&#65289;&#20320;&#21487;&#20197;&#29992;&#26469;&#21160;&#24577;&#21019;&#24314;&#23545;&#35937;&#12290;&#36825;&#37324;&#25105;&#20204;&#26159;&#22312;&#36171;&#20540;&#12290;<code>volume<\/code>&#21644;&#25105;&#26377;&#20160;&#20040;&#38382;&#39064;&#21527;&#65311;<code>surfaceArea<\/code>&#36825;&#20010;&#23545;&#35937;&#30340;&#23646;&#24615;&#22914;&#19979;&#65306;&#20320;&#21487;&#20197;&#36890;&#36807;&#31661;&#22836;&#36816;&#31639;&#31526;&#65288;-&gt;&#65289;&#35775;&#38382;&#36825;&#20123;&#23646;&#24615;&#12290;<\/p>\n<h2>&#39069;&#22806;&#30340;&#25552;&#31034;&#21644;&#32771;&#34385;&#22240;&#32032;<\/h2>\n<p>&#22312;PHP&#20989;&#25968;&#36820;&#22238;&#22810;&#20010;&#20540;&#26102;&#65292;&#26377;&#20960;&#20010;&#38656;&#35201;&#27880;&#24847;&#30340;&#20107;&#39033;&#12290;&#39318;&#20808;&#65292;&#34429;&#28982;&#20351;&#29992;&#25968;&#32452;&#25110;&#23545;&#35937;&#24456;&#26041;&#20415;&#65292;&#20294;&#21487;&#33021;&#20250;&#25513;&#30422;&#20989;&#25968;&#36820;&#22238;&#30340;&#20869;&#23481;&#65292;&#29305;&#21035;&#26159;&#22312;&#20989;&#25968;&#25991;&#26723;&#19981;&#28165;&#26970;&#30340;&#24773;&#20917;&#19979;&#12290;&#24635;&#26159;&#35814;&#32454;&#22320;&#27880;&#37322;&#20320;&#30340;&#20989;&#25968;&#20197;&#34920;&#26126;&#23427;&#20204;&#36820;&#22238;&#20160;&#20040;&#31867;&#22411;&#21644;&#32467;&#26500;&#30340;&#20540;&#26159;&#38750;&#24120;&#37325;&#35201;&#30340;&#12290;<\/p>\n<p>&#21478;&#19968;&#20010;&#38656;&#35201;&#32771;&#34385;&#30340;&#26159;&#65292;&#22914;&#26524;&#20351;&#29992;&#23545;&#35937;&#36820;&#22238;&#22810;&#20010;&#20540;&#65292;&#21017;&#36890;&#24120;&#26368;&#22909;&#21019;&#24314;&#19968;&#20010;&#29305;&#23450;&#30340;&#31867;&#26469;&#23454;&#29616;&#36825;&#19968;&#28857;&#65292;&#32780;&#19981;&#26159;&#20351;&#29992;&#29616;&#26377;&#30340;&#26041;&#27861;&#12290;<code>stdClass<\/code>&#36825;&#26679;&#20570;&#21487;&#20197;&#20351;&#20195;&#30721;&#26356;&#20855;&#33258;&#25991;&#26723;&#24615;&#65292;&#26377;&#21161;&#20110;IDE&#20013;&#30340;&#33258;&#21160;&#23436;&#25104;&#21151;&#33021;&#12290;<\/p>\n<p>&#26368;&#21518;&#65292;&#35201;&#35686;&#24789;&#22914;&#26524;&#38656;&#35201;&#39057;&#32321;&#20174;&#20989;&#25968;&#36820;&#22238;&#22823;&#37327;&#20540;&#26102;&#65292;&#21487;&#33021;&#20250;&#23545;&#24615;&#33021;&#20135;&#29983;&#24433;&#21709;&#65292;&#22312;&#32321;&#24537;&#30340;web&#24212;&#29992;&#20013;&#23588;&#20854;&#38656;&#35201;&#27880;&#24847;&#36825;&#19968;&#28857;&#12290;&#27599;&#31181;&#26041;&#27861;&#37117;&#26377;&#20854;&#21508;&#33258;&#30340;&#24320;&#38144;&#65292;&#26377;&#26102;&#21487;&#33021;&#38656;&#35201;&#23457;&#26597;&#24212;&#29992;&#31243;&#24207;&#26550;&#26500;&#20197;&#37319;&#29992;&#26356;&#39640;&#25928;&#30340;&#25968;&#25454;&#31649;&#29702;&#31574;&#30053;&#12290;<\/p>\n<h2>&#32467;&#35770;<\/h2>\n<p>&#22312;&#26412;&#25945;&#31243;&#20013;&#65292;&#25105;&#20204;&#24050;&#32463;&#30475;&#21040;&#22914;&#20309;&#22312;PHP&#20013;&#23450;&#20041;&#20989;&#25968;&#26469;&#36820;&#22238;&#22810;&#20010;&#20540;&#65292;&#36825;&#22312;PHP&#20013;&#24182;&#19981;&#30452;&#25509;&#25903;&#25345;&#65292;&#20294;&#21487;&#20197;&#36890;&#36807;&#25968;&#32452;&#21644;&#23545;&#35937;&#26469;&#23454;&#29616;&#12290;&#36825;&#31181;&#26041;&#27861;&#21487;&#20197;&#26174;&#33879;&#25552;&#39640;&#20195;&#30721;&#30340;&#32467;&#26500;&#32452;&#32455;&#24615;&#21644;&#21487;&#35835;&#24615;&#12290;&#24076;&#26395;&#20320;&#22312;PHP&#24320;&#21457;&#26053;&#31243;&#20013;&#25214;&#21040;&#20102;&#36825;&#20221;&#25351;&#21335;&#30340;&#26377;&#29992;&#20043;&#22788;&#12290;<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#27010;&#35272; PHP &#26159;&#19968;&#31181;&#24191;&#27867;&#29992;&#20110;&#32593;&#39029;&#24320;&#21457;&#30340;&#26381;&#21153;&#22120;&#31471;&#33050;&#038;#2..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false},"tags":[],"my1js2nav":[38],"tuisongtax":[],"class_list":["post-423","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\/423","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=423"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tags?post=423"},{"taxonomy":"my1js2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js2nav?post=423"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tuisongtax?post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}