{"id":407,"date":"2025-06-10T19:59:14","date_gmt":"2025-06-10T11:59:14","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/php\/php-application-manual\/jcyy\/407.html"},"modified":"2025-06-10T19:59:14","modified_gmt":"2025-06-10T11:59:14","slug":"php%ef%bc%9a%e5%a6%82%e4%bd%95%e5%90%af%e7%94%a8-%e7%a6%81%e7%94%a8%e8%ad%a6%e5%91%8a%e5%92%8c%e9%80%9a%e7%9f%a5","status":"publish","type":"my1js","link":"https:\/\/www.zhaozhao123.cn\/php\/my1js\/407.html","title":{"rendered":"PHP\uff1a\u5982\u4f55\u542f\u7528\/\u7981\u7528\u8b66\u544a\u548c\u901a\u77e5"},"content":{"rendered":"<p><body><\/p>\n<h2>&#27010;&#36848;<\/h2>\n<p>&#22788;&#29702;PHP&#20013;&#30340;&#35686;&#21578;&#21644;&#36890;&#30693;&#23545;&#20110;&#24320;&#21457;&#20581;&#22766;&#30340;&#24212;&#29992;&#31243;&#24207;&#33267;&#20851;&#37325;&#35201;&#12290;&#26080;&#35770;&#26159;&#38656;&#35201;&#22312;&#24320;&#21457;&#36807;&#31243;&#20013;&#35843;&#35797;&#20195;&#30721;&#36824;&#26159;&#30830;&#20445;&#29983;&#20135;&#29615;&#22659;&#30340;&#31283;&#23450;&#24615;&#65292;&#25511;&#21046;PHP&#38169;&#35823;&#25253;&#21578;&#37117;&#26159;&#24320;&#21457;&#32773;&#24517;&#39035;&#25484;&#25569;&#30340;&#19968;&#39033;&#25216;&#33021;&#12290;&#26412;&#25945;&#31243;&#23558;&#25351;&#23548;&#24744;&#22914;&#20309;&#21551;&#29992;&#25110;&#31105;&#29992;PHP&#20013;&#30340;&#35686;&#21578;&#21644;&#36890;&#30693;&#12290;<\/p>\n<h2>&#29702;&#35299;PHP&#38169;&#35823;&#32423;&#21035;<\/h2>\n<p>&#22312;&#28145;&#20837;&#20462;&#25913;&#38169;&#35823;&#25253;&#21578;&#34892;&#20026;&#20043;&#21069;&#65292;&#39318;&#20808;&#38656;&#35201;&#20102;&#35299;PHP&#20013;&#19981;&#21516;&#30340;&#38169;&#35823;&#32423;&#21035;&#65306;<\/p>\n<p>&#20363;&#22806;&#65306;&#36825;&#20123;&#26159;&#22312;&#36816;&#34892;&#26102;&#21457;&#29983;&#30340;&#38169;&#35823;&#65292;PHP &#20801;&#35768;&#24744;&#20351;&#29992; try\/catch &#22359;&#26469;&#25429;&#33719;&#21644;&#22788;&#29702;&#23427;&#20204;&#12290;<\/p>\n<p>&#38169;&#35823;&#65306;&#23548;&#33268;&#33050;&#26412;&#25191;&#34892;&#20013;&#26029;&#30340;&#33268;&#21629;&#38382;&#39064;&#12290;&#20363;&#22914;&#65292;&#35843;&#29992;&#26410;&#23450;&#20041;&#20989;&#25968;&#25110;&#35821;&#27861;&#38169;&#35823;&#12290;<\/p>\n<p>&#35686;&#21578;&#65306;&#26356;&#22810;&#20005;&#37325;&#30340;&#38382;&#39064;&#65292;&#20294;&#19982;&#36890;&#30693;&#19981;&#21516;&#65292;&#23427;&#20204;&#19981;&#20250;&#20013;&#26029;&#33050;&#26412;&#25191;&#34892;&#12290;&#20363;&#22914;&#65292;&#21253;&#25324;&#19981;&#23384;&#22312;&#30340;&#25991;&#20214;&#12290;<\/p>\n<p>&#36890;&#30693;&#65306;&#36825;&#20123;&#26159;&#24744;&#20195;&#30721;&#20013;&#30340;&#36731;&#24494;&#12289;&#38750;&#20851;&#38190;&#24615;&#38382;&#39064;&#65292;PHP &#20250;&#21457;&#29616;&#36825;&#20123;&#38382;&#39064;&#12290;&#23427;&#20204;&#19981;&#20250;&#38459;&#27490;&#33050;&#26412;&#30340;&#25191;&#34892;&#12290;&#20363;&#22914;&#65292;&#35775;&#38382;&#26410;&#23450;&#20041;&#30340;&#21464;&#37327;&#25110;&#32034;&#24341;&#12290;<\/p>\n<h2>&#37197;&#32622;&#38169;&#35823;&#25253;&#21578;<\/h2>\n<p>&#26377;&#22810;&#31181;&#26041;&#27861;&#26469;&#37197;&#32622;PHP&#38169;&#35823;&#25253;&#21578;&#65306;<\/p>\n<h3>&#20351;&#29992;php.ini<\/h3>\n<p>php.ini &#26159; PHP &#30340;&#20027;&#37197;&#32622;&#25991;&#20214;&#12290;&#35201;&#20026;&#25152;&#26377;&#33050;&#26412;&#35774;&#32622;&#38169;&#35823;&#25253;&#21578;&#32423;&#21035;&#65292;&#35831;&#26597;&#25214; error_reporting &#30452;&#25509;&#24182;&#30456;&#24212;&#22320;&#20462;&#25913;&#23427;&#65306;<\/p>\n<pre><code>error_reporting = E_ALL &amp; ~E_NOTICE &amp; ~E_WARNING\n<\/code><\/pre>\n<p>&#36825;&#31181;&#37197;&#32622;&#21482;&#20250;&#25253;&#21578;&#38169;&#35823;&#65292;&#19981;&#21253;&#25324;&#35686;&#21578;&#21644;&#20449;&#24687;&#12290;<\/p>\n<h3>&#22312;&#36816;&#34892;&#26102;&#12290;<\/h3>\n<p>&#20320;&#21487;&#20197;&#36890;&#36807;&#36816;&#34892;&#26102;&#20462;&#25913;&#38169;&#35823;&#25253;&#21578;&#32423;&#21035;&#26469;&#20351;&#29992; error_reporting() &#20989;&#25968;&#65306;<\/p>\n<pre><code>error_reporting(E_ALL &amp; ~E_NOTICE &amp; ~E_WARNING);\n<\/code><\/pre>\n<p>&#22312;&#24744;&#30340;&#33050;&#26412;&#24320;&#22836;&#28155;&#21152;&#20197;&#19979;&#34892;&#20197;&#20165;&#24433;&#21709;&#23545;&#35813;&#33050;&#26412;&#30340;&#38169;&#35823;&#25253;&#21578;&#65306;<\/p>\n<h3>&#20351;&#29992;.htaccess<\/h3>\n<p>&#22914;&#26524;&#20320;&#20351;&#29992;&#30340;&#26159;Apache&#65292;&#21487;&#20197;&#36890;&#36807;.htaccess&#25991;&#20214;&#26469;&#25511;&#21046;&#38169;&#35823;&#25253;&#21578;&#65306;<\/p>\n<pre><code>php_value error_reporting 30711\n<\/code><\/pre>\n<p>&#25968;&#23383;30711&#31561;&#21516;&#20110;E_ALL&#19982;~E_NOTICE&#21644;~E_WARNING&#30340;&#32452;&#21512;&#65292;&#35745;&#31639;&#24744;&#24076;&#26395;&#25253;&#21578;&#30340;&#32423;&#21035;&#20540;&#12290;<\/p>\n<h2>&#27491;&#22312;&#26174;&#31034;&#38169;&#35823;&#12290;<\/h2>\n<p>&#38500;&#20102;&#35774;&#23450;&#38169;&#35823;&#25253;&#21578;&#30340;&#32423;&#21035;&#65292;&#24744;&#36824;&#21487;&#20197;&#25511;&#21046;&#26159;&#21542;&#22312;&#23631;&#24149;&#19978;&#26174;&#31034;&#38169;&#35823;&#36824;&#26159;&#23558;&#20854;&#35760;&#24405;&#65306;<\/p>\n<h3>&#20351;&#29992;php.ini<\/h3>\n<pre><code>display_errors = On\nlog_errors = On\nerror_log = \/path\/to\/your\/error_log.log\n<\/code><\/pre>\n<p>&#22312;&#29983;&#20135;&#29615;&#22659;&#20013;&#23558;&#26174;&#31034;&#38169;&#35823;&#20449;&#24687;&#65288;display errors&#65289;&#35774;&#32622;&#20026;&ldquo;Off&rdquo;&#20197;&#36991;&#20813;&#26292;&#38706;&#25935;&#24863;&#20449;&#24687;&#12290;<\/p>\n<h3>&#22312;&#36816;&#34892;&#26102;<\/h3>\n<pre><code>ini_set('display_errors', '1');\nini_set('log_errors', '1');\nini_set('error_log', '\/path\/to\/your\/error_log.log');\n<\/code><\/pre>\n<p>&#22312;&#33050;&#26412;&#24320;&#22987;&#26102;&#20351;&#29992;&#36825;&#20123;&#21151;&#33021;&#26469;&#25511;&#21046;&#36816;&#34892;&#26102;&#30340;&#38169;&#35823;&#26174;&#31034;&#21644;&#26085;&#24535;&#35760;&#24405;&#12290;<\/p>\n<h2>&#31649;&#29702;&#36890;&#30693;&#21644;&#35686;&#21578;<\/h2>\n<p>&#20309;&#26102;&#21551;&#29992;&#25110;&#31105;&#29992;&#36890;&#30693;&#21644;&#35686;&#21578;&#65311;<\/p>\n<p>&#29983;&#20135;&#65306;&#36890;&#24120;&#24744;&#24076;&#26395;&#31105;&#29992;&#23631;&#24149;&#19978;&#30340;&#38169;&#35823;&#25253;&#21578;&#65292;&#32780;&#26159;&#30830;&#20445;&#25152;&#26377;&#38169;&#35823;&#37117;&#34987;&#35760;&#24405;&#19979;&#26469;&#20197;&#20445;&#38556;&#23433;&#20840;&#12290;<\/p>\n<p>&#24320;&#21457;&#65306;&#20026;&#20102;&#23613;&#26089;&#21457;&#29616;&#28508;&#22312;&#38382;&#39064;&#65292;&#24314;&#35758;&#21551;&#29992;&#25152;&#26377;&#38169;&#35823;&#25253;&#21578;&#21151;&#33021;&#12290;<\/p>\n<h2>&#38169;&#35823;&#22788;&#29702;&#26368;&#20339;&#23454;&#36341;<\/h2>\n<p>&#23450;&#26399;&#30417;&#25511;&#26085;&#24535;&#20197;&#23613;&#26089;&#21457;&#29616;&#24182;&#20462;&#22797;&#38169;&#35823;&#12290;<\/p>\n<p>&#20351;&#29992;&#33258;&#23450;&#20041;&#38169;&#35823;&#22788;&#29702;&#22120;&#26469;&#26356;&#20248;&#38597;&#22320;&#31649;&#29702;&#21644;&#25552;&#20379;&#38382;&#39064;&#30340;&#19978;&#19979;&#25991;&#65292;&#20197;&#25552;&#39640;&#22788;&#29702;&#38169;&#35823;&#30340;&#25928;&#29575;&#12290;<\/p>\n<p>&#36991;&#20813;&#20351;&#29992;&ldquo;@&rdquo;&#25233;&#21046;&#31526;&#65292;&#22240;&#20026;&#23427;&#20250;&#25513;&#30422;&#28508;&#22312;&#30340;&#38382;&#39064;&#65292;&#20174;&#32780;&#20351;&#24471;&#35843;&#35797;&#21464;&#24471;&#22256;&#38590;&#12290;<\/p>\n<h2>&#32467;&#35770;&#12290;<\/h2>\n<p>&#25511;&#21046;PHP&#26174;&#31034;&#21644;&#35760;&#24405;&#35686;&#21578;&#12289;&#36890;&#30693;&#30340;&#21151;&#33021;&#65292;&#20026;&#31649;&#29702;&#24212;&#29992;&#31243;&#24207;&#30340;&#34892;&#20026;&#21644;&#31283;&#23450;&#24615;&#25552;&#20379;&#20102;&#19968;&#31181;&#24378;&#22823;&#30340;&#24037;&#20855;&#12290;&#35831;&#35760;&#20303;&#65292;&#22312;&#24320;&#21457;&#21644;&#29983;&#20135;&#29615;&#22659;&#20013;&#20351;&#29992;&#19981;&#21516;&#30340;&#37197;&#32622;&#20197;&#26368;&#22823;&#21270;&#25928;&#29575;&#21644;&#23433;&#20840;&#24615;&#12290;&#26377;&#20102;&#36825;&#20123;&#30693;&#35782;&#65292;&#24744;&#24050;&#32463;&#20570;&#22909;&#20102;&#31649;&#29702;PHP&#24212;&#29992;&#31243;&#24207;&#38169;&#35823;&#25253;&#21578;&#30340;&#20934;&#22791;&#12290;<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#27010;&#36848; &#22788;&#29702;PHP&#20013;&#30340;&#35686;&#21578;&#21644;&#36890;&#30693;&#23545;&#20110;&#24320;&#21457;&#20581;&#22766;&#30340;&#24212;&#038;#29..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false},"tags":[],"my1js2nav":[38],"tuisongtax":[],"class_list":["post-407","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\/407","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=407"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tags?post=407"},{"taxonomy":"my1js2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/my1js2nav?post=407"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/php\/wp-json\/wp\/v2\/tuisongtax?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}