{"id":47383,"date":"2024-12-02T16:23:28","date_gmt":"2024-12-02T08:23:28","guid":{"rendered":"https:\/\/fwq.ai\/blog\/47383\/"},"modified":"2024-12-02T16:23:28","modified_gmt":"2024-12-02T08:23:28","slug":"php-%e5%87%bd%e6%95%b0%e9%80%92%e5%bd%92%e8%b0%83%e7%94%a8%e7%9a%84%e5%a0%86%e6%a0%88%e9%99%90%e5%88%b6%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/47383\/","title":{"rendered":"PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f<\/h1>\n<p>\u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aPHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f\u300b<\/span>\uff0c\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u70b9\u5305\u62ec<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\uff0c\u65e0\u8bba\u4f60\u662f\u5c0f\u767d\u8fd8\u662f\u8001\u624b\uff0c\u90fd\u9002\u5408\u770b\u4e00\u770b\u54e6~\u6709\u597d\u7684\u5efa\u8bae\u4e5f\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u82e5\u662f\u770b\u5b8c\u6709\u6240\u6536\u83b7\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u591a\u591a\u70b9\u8d5e\u652f\u6301\u5440\uff01\u4e00\u8d77\u52a0\u6cb9\u5b66\u4e60~<\/p>\n<p>PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u53ef\u4ee5\u901a\u8fc7 ini_set() \u51fd\u6570\u8bbe\u7f6e\uff0c\u5982 ini_set(&#8216;xdebug.max_nesting_level&#8217;, 256)\u30021. \u9ed8\u8ba4\u5806\u6808\u9650\u5236\u4e3a 8MB\u30022. \u4f7f\u7528\u5927\u91cf\u9012\u5f52\u8c03\u7528\u7684\u5e94\u7528\u7a0b\u5e8f\u53ef\u80fd\u9700\u8981\u589e\u52a0\u5806\u6808\u9650\u5236\u30023. \u4f7f\u7528 ini_set() \u51fd\u6570\u53ef\u8bbe\u7f6e\u5806\u6808\u9650\u5236\uff0c\u5982 ini_set(&#8216;xdebug.max_nesting_level&#8217;, 100000)\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241026\/1729915113671c68e9db79c.jpg\" class=\"aligncenter\" title=\"PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f\u63d2\u56fe\" alt=\"PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f\u63d2\u56fe\" \/><\/p>\n<h2>PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e?<\/h2>\n<p><strong>\u9012\u5f52\u8c03\u7528<\/strong><\/p>\n<p>\u9012\u5f52\u8c03\u7528\u662f\u5728\u51fd\u6570\u5185\u90e8\u8c03\u7528\u81ea\u8eab\u7684\u8fc7\u7a0b\u3002\u5b83\u662f\u4e00\u79cd\u5f3a\u5927\u7684\u6280\u672f\uff0c\u4f46\u5982\u679c\u4f7f\u7528\u4e0d\u5f53\uff0c\u4f1a\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u3002\u5806\u6808\u662f\u7528\u4e8e\u5b58\u50a8\u51fd\u6570\u8c03\u7528\u7684\u5185\u5b58\u533a\u57df\uff0c\u5b83\u7684\u5927\u5c0f\u6709\u9650\u3002<\/p>\n<p><strong>PHP \u7684\u5806\u6808\u9650\u5236<\/strong><\/p>\n<p>PHP \u9ed8\u8ba4\u7684\u5806\u6808\u9650\u5236\u4e3a 8MB\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0c\u8fd9\u5df2\u7ecf\u8db3\u591f\u4e86\u3002\u4f46\u662f\uff0c\u5bf9\u4e8e\u67d0\u4e9b\u4f7f\u7528\u5927\u91cf\u9012\u5f52\u8c03\u7528\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u80fd\u9700\u8981\u589e\u52a0\u5806\u6808\u9650\u5236\u3002<\/p>\n<p><strong>\u8bbe\u7f6e\u5806\u6808\u9650\u5236<\/strong><\/p>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528 ini_set() \u51fd\u6570\u8bbe\u7f6e PHP \u7684\u5806\u6808\u9650\u5236\uff1a<\/p>\n<pre>ini_set('xdebug.max_nesting_level', 256);<\/pre>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5728 xdebug \u6269\u5c55\u4e2d\u8bbe\u7f6e\u4e86\u5141\u8bb8\u7684\u6700\u5927\u5d4c\u5957\u7ea7\u522b\uff08\u5373\u9012\u5f52\u8c03\u7528\u7684\u6df1\u5ea6\uff09\u4e3a 256\u3002<\/p>\n<p><strong>\u5b9e\u6218\u6848\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528\u9012\u5f52\u8c03\u7528\u7684\u7b80\u5355\u51fd\u6570\u793a\u4f8b\uff1a<\/p>\n<pre>function factorial($n)\n{\n    if ($n == 0) {\n        return 1;\n    }\n    return $n * factorial($n - 1);\n}<\/pre>\n<p>\u5982\u679c\u6211\u4eec\u5c1d\u8bd5\u8ba1\u7b97\u4e00\u4e2a\u5f88\u5927\u7684\u9636\u4e58\uff0c\u6bd4\u5982 100000\uff0c\u5c31\u4f1a\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u589e\u52a0\u5806\u6808\u9650\u5236\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>ini_set('xdebug.max_nesting_level', 100000);\n\n$result = factorial(100000);<\/pre>\n<p>\u73b0\u5728\uff0c\u51fd\u6570\u5c06\u6210\u529f\u6267\u884c\u5e76\u8fd4\u56de\u7ed3\u679c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aPHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8ePHP \u51fd\u6570,\u5806\u6808\u9650\u5236\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f \u4eca\u5929\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e86\u300aPHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e\uff1f\u300b\uff0c\u5176\u4e2d\u6d89\u53ca\u5230\u7684\u77e5\u8bc6\u70b9\u5305\u62ec\u7b49\u7b49\uff0c\u65e0\u8bba\u4f60\u662f\u5c0f\u767d\u8fd8\u662f\u8001\u624b\uff0c\u90fd\u9002\u5408\u770b\u4e00\u770b\u54e6~\u6709\u597d\u7684\u5efa\u8bae\u4e5f\u6b22\u8fce\u5927\u5bb6\u5728\u8bc4\u8bba\u7559\u8a00\uff0c\u82e5\u662f\u770b\u5b8c\u6709\u6240\u6536\u83b7\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u80fd\u591a\u591a\u70b9\u8d5e\u652f\u6301\u5440\uff01\u4e00\u8d77\u52a0\u6cb9\u5b66\u4e60~ PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u53ef\u4ee5\u901a\u8fc7 ini_set() \u51fd\u6570\u8bbe\u7f6e\uff0c\u5982 ini_set(&#8216;xdebug.max_nesting_level&#8217;, 256)\u30021. \u9ed8\u8ba4\u5806\u6808\u9650\u5236\u4e3a 8MB\u30022. \u4f7f\u7528\u5927\u91cf\u9012\u5f52\u8c03\u7528\u7684\u5e94\u7528\u7a0b\u5e8f\u53ef\u80fd\u9700\u8981\u589e\u52a0\u5806\u6808\u9650\u5236\u30023. \u4f7f\u7528 ini_set() \u51fd\u6570\u53ef\u8bbe\u7f6e\u5806\u6808\u9650\u5236\uff0c\u5982 ini_set(&#8216;xdebug.max_nesting_level&#8217;, 100000)\u3002 PHP \u51fd\u6570\u9012\u5f52\u8c03\u7528\u7684\u5806\u6808\u9650\u5236\u5982\u4f55\u8bbe\u7f6e? \u9012\u5f52\u8c03\u7528 \u9012\u5f52\u8c03\u7528\u662f\u5728\u51fd\u6570\u5185\u90e8\u8c03\u7528\u81ea\u8eab\u7684\u8fc7\u7a0b\u3002\u5b83\u662f\u4e00\u79cd\u5f3a\u5927\u7684\u6280\u672f\uff0c\u4f46\u5982\u679c\u4f7f\u7528\u4e0d\u5f53\uff0c\u4f1a\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u3002\u5806\u6808\u662f\u7528\u4e8e\u5b58\u50a8\u51fd\u6570\u8c03\u7528\u7684\u5185\u5b58\u533a\u57df\uff0c\u5b83\u7684\u5927\u5c0f\u6709\u9650\u3002 PHP \u7684\u5806\u6808\u9650\u5236 PHP \u9ed8\u8ba4\u7684\u5806\u6808\u9650\u5236\u4e3a 8MB\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0c\u8fd9\u5df2\u7ecf\u8db3\u591f\u4e86\u3002\u4f46\u662f\uff0c\u5bf9\u4e8e\u67d0\u4e9b\u4f7f\u7528\u5927\u91cf\u9012\u5f52\u8c03\u7528\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u80fd\u9700\u8981\u589e\u52a0\u5806\u6808\u9650\u5236\u3002 \u8bbe\u7f6e\u5806\u6808\u9650\u5236 \u60a8\u53ef\u4ee5\u4f7f\u7528 ini_set() \u51fd\u6570\u8bbe\u7f6e PHP \u7684\u5806\u6808\u9650\u5236\uff1a ini_set(&#8216;xdebug.max_nesting_level&#8217;, 256); \u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5728 xdebug \u6269\u5c55\u4e2d\u8bbe\u7f6e\u4e86\u5141\u8bb8\u7684\u6700\u5927\u5d4c\u5957\u7ea7\u522b\uff08\u5373\u9012\u5f52\u8c03\u7528\u7684\u6df1\u5ea6\uff09\u4e3a 256\u3002 \u5b9e\u6218\u6848\u4f8b \u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528\u9012\u5f52\u8c03\u7528\u7684\u7b80\u5355\u51fd\u6570\u793a\u4f8b\uff1a function factorial($n) { if ($n == 0) { return 1; } return $n * [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-47383","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=47383"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47383\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=47383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=47383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=47383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}