{"id":47094,"date":"2024-12-02T10:01:52","date_gmt":"2024-12-02T02:01:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/47094\/"},"modified":"2024-12-02T10:01:52","modified_gmt":"2024-12-02T02:01:52","slug":"php-%e4%b8%ad%e5%a0%86%e6%a0%88%e6%ba%a2%e5%87%ba%e4%b8%8e%e5%86%85%e5%ad%98%e6%ba%a2%e5%87%ba%e7%9a%84%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/47094\/","title":{"rendered":"PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b<\/h1>\n<p>\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u8981\u52aa\u529b\uff0c\u4f46\u662f\u4e0d\u8981\u6025\uff01\u4eca\u5929\u7684\u8fd9\u7bc7\u6587\u7ae0<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aPHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b\u300b<\/span>\u5c06\u4f1a\u4ecb\u7ecd\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u60f3\u6df1\u5165\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\uff0c\u53ef\u4ee5\u5173\u6ce8\u6211\uff01\u6211\u4f1a\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u6587\u7ae0\u7684\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u90fd\u80fd\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p>PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u548c\u5185\u5b58\u6ea2\u51fa\u6709\u7740\u4e0d\u540c\u7684\u539f\u56e0\u53ca\u75c7\u72b6\u3002\u5806\u6808\u6ea2\u51fa\u53d1\u751f\u5728\u7a0b\u5e8f\u9012\u5f52\u8c03\u7528\u8fc7\u591a\u65f6\uff0c\u8868\u73b0\u4e3a\u7a0b\u5e8f\u5d29\u6e83\u548c &#8220;Maximum function nesting level reached&#8221; \u9519\u8bef\uff1b\u5185\u5b58\u6ea2\u51fa\u53d1\u751f\u5728\u5206\u914d\u7684\u5185\u5b58\u8d85\u8fc7\u53ef\u7528\u5185\u5b58\u65f6\uff0c\u8868\u73b0\u4e3a\u7a0b\u5e8f\u5d29\u6e83\u548c &#8220;Out of memory&#8221; \u9519\u8bef\u3002\u4fee\u590d\u5806\u6808\u6ea2\u51fa\u9700\u9650\u5236\u9012\u5f52\u6df1\u5ea6\u6216\u4f18\u5316\u4ee3\u7801\uff1b\u4fee\u590d\u5185\u5b58\u6ea2\u51fa\u5219\u9700\u5408\u7406\u5206\u914d\u5185\u5b58\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u53d8\u91cf\u5206\u914d\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241025\/1729865805671ba84d0642b.jpg\" class=\"aligncenter\" title=\"PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b\u63d2\u56fe\" alt=\"PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b\u63d2\u56fe\" \/><\/p>\n<p><strong>PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b<\/strong><\/p>\n<p>\u5728 PHP \u4e2d\uff0c\u5806\u6808\u6ea2\u51fa\u548c\u5185\u5b58\u6ea2\u51fa\u90fd\u662f\u5e38\u89c1\u7684\u9519\u8bef\uff0c\u4f46\u5b83\u4eec\u6709\u7740\u4e0d\u540c\u7684\u539f\u56e0\u548c\u75c7\u72b6\u3002<\/p>\n<p><strong>\u5806\u6808\u6ea2\u51fa<\/strong><\/p>\n<p>\u5806\u6808\u6ea2\u51fa\u53d1\u751f\u5728\u7a0b\u5e8f\u9012\u5f52\u8c03\u7528\u81ea\u8eab\u8fc7\u591a\u6b21\u6570\u65f6\u3002PHP \u89e3\u91ca\u5668\u5728\u6267\u884c\u51fd\u6570\u65f6\u4f1a\u521b\u5efa\u4e00\u4e2a\u5806\u6808\u5e27\uff0c\u5176\u4e2d\u5305\u542b\u5c40\u90e8\u53d8\u91cf\u3001\u53c2\u6570\u548c\u51fd\u6570\u8fd4\u56de\u5730\u5740\u3002\u5f53\u5806\u6808\u53d8\u5f97\u592a\u5927\u4ee5\u81f3\u4e8e\u65e0\u6cd5\u5bb9\u7eb3\u65b0\u7684\u5e27\u65f6\uff0c\u5c31\u4f1a\u53d1\u751f\u5806\u6808\u6ea2\u51fa\u3002<\/p>\n<p><strong> \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b:<\/strong><\/p>\n<ul>\n<li>\u7a0b\u5e8f\u5d29\u6e83\uff0c\u9519\u8bef\u6d88\u606f\u4e3a &#8220;Fatal error: Maximum function nesting level of &#8216;100&#8217; reached, aborting!&#8221;<\/li>\n<\/ul>\n<p><strong> \u5185\u5b58\u6ea2\u51fa<\/strong><\/p>\n<p>\u5185\u5b58\u6ea2\u51fa\u53d1\u751f\u5728\u7a0b\u5e8f\u5206\u914d\u4e86\u6bd4\u53ef\u7528\u5185\u5b58\u66f4\u591a\u7684\u5185\u5b58\u65f6\u3002PHP \u4e2d\u7684\u5185\u5b58\u662f\u7531 PHP \u8fd0\u884c\u65f6\u7ba1\u7406\u7684\uff0c\u5f53\u8fd0\u884c\u65f6\u5c1d\u8bd5\u5206\u914d\u8d85\u8fc7\u5206\u914d\u7ed9 PHP \u7684\u5185\u5b58\u65f6\uff0c\u5c31\u4f1a\u53d1\u751f\u5185\u5b58\u6ea2\u51fa\u3002<\/p>\n<p><strong> \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b:<\/strong><\/p>\n<ul>\n<li>\u7a0b\u5e8f\u5d29\u6e83\uff0c\u9519\u8bef\u6d88\u606f\u4e3a &#8220;Fatal error: Out of memory!&#8221;<\/li>\n<\/ul>\n<p><strong> \u5b9e\u6218\u6848\u4f8b<\/strong><\/p>\n<p><strong>\u5806\u6808\u6ea2\u51fa<\/strong><\/p>\n<pre>function recurse() {\n    recurse();\n}\n\nrecurse();<\/pre>\n<p>\u8fd9\u4e2a\u4ee3\u7801\u4f1a\u4e0d\u65ad\u9012\u5f52\u8c03\u7528\u81ea\u8eab\uff0c\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u3002<\/p>\n<p><strong>\u5185\u5b58\u6ea2\u51fa<\/strong><\/p>\n<pre>$array = [];\nwhile (true) {\n    $array[] = rand();\n}<\/pre>\n<p>\u8fd9\u4e2a\u4ee3\u7801\u521b\u5efa\u4e86\u4e00\u4e2a\u4e0d\u65ad\u589e\u957f\u7684\u6570\u7ec4\uff0c\u6700\u7ec8\u4f1a\u5bfc\u81f4\u5185\u5b58\u6ea2\u51fa\u3002<\/p>\n<p><strong>\u5982\u4f55\u4fee\u590d<\/strong><\/p>\n<p><strong>\u5806\u6808\u6ea2\u51fa<\/strong><\/p>\n<ul>\n<li>\u9650\u5236\u9012\u5f52\u6df1\u5ea6<\/li>\n<li>\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316<\/li>\n<li>\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u9012\u5f52\u8c03\u7528<\/li>\n<\/ul>\n<p><strong>\u5185\u5b58\u6ea2\u51fa<\/strong><\/p>\n<ul>\n<li>\u4f7f\u7528\u5e26\u6709\u5408\u9002\u7684\u9650\u5236\u7684\u5185\u5b58\u7ba1\u7406\u673a\u5236<\/li>\n<li>\u4f7f\u7528\u5bf9\u8c61\u6c60\u7ba1\u7406\u5185\u5b58\u5206\u914d<\/li>\n<li>\u907f\u514d\u5206\u914d\u4e0d\u5fc5\u8981\u7684\u53d8\u91cf<\/li>\n<\/ul>\n<p>\u4eca\u5929\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff1b\u5173\u4e8e\u6587\u7ae0\u7684\u6280\u672f\u77e5\u8bc6\u6211\u4eec\u4f1a\u4e00\u70b9\u70b9\u6df1\u5165\u4ecb\u7ecd\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u4e00\u8d77\u5b66\u4e60\u7f16\u7a0b~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b \u5b66\u4e60\u6587\u7ae0\u8981\u52aa\u529b\uff0c\u4f46\u662f\u4e0d\u8981\u6025\uff01\u4eca\u5929\u7684\u8fd9\u7bc7\u6587\u7ae0\u300aPHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b\u300b\u5c06\u4f1a\u4ecb\u7ecd\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u60f3\u6df1\u5165\u5b66\u4e60\u6587\u7ae0\uff0c\u53ef\u4ee5\u5173\u6ce8\u6211\uff01\u6211\u4f1a\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u6587\u7ae0\u7684\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u90fd\u80fd\u6709\u6240\u5e2e\u52a9\uff01 PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u548c\u5185\u5b58\u6ea2\u51fa\u6709\u7740\u4e0d\u540c\u7684\u539f\u56e0\u53ca\u75c7\u72b6\u3002\u5806\u6808\u6ea2\u51fa\u53d1\u751f\u5728\u7a0b\u5e8f\u9012\u5f52\u8c03\u7528\u8fc7\u591a\u65f6\uff0c\u8868\u73b0\u4e3a\u7a0b\u5e8f\u5d29\u6e83\u548c &#8220;Maximum function nesting level reached&#8221; \u9519\u8bef\uff1b\u5185\u5b58\u6ea2\u51fa\u53d1\u751f\u5728\u5206\u914d\u7684\u5185\u5b58\u8d85\u8fc7\u53ef\u7528\u5185\u5b58\u65f6\uff0c\u8868\u73b0\u4e3a\u7a0b\u5e8f\u5d29\u6e83\u548c &#8220;Out of memory&#8221; \u9519\u8bef\u3002\u4fee\u590d\u5806\u6808\u6ea2\u51fa\u9700\u9650\u5236\u9012\u5f52\u6df1\u5ea6\u6216\u4f18\u5316\u4ee3\u7801\uff1b\u4fee\u590d\u5185\u5b58\u6ea2\u51fa\u5219\u9700\u5408\u7406\u5206\u914d\u5185\u5b58\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u53d8\u91cf\u5206\u914d\u3002 PHP \u4e2d\u5806\u6808\u6ea2\u51fa\u4e0e\u5185\u5b58\u6ea2\u51fa\u7684\u533a\u522b \u5728 PHP \u4e2d\uff0c\u5806\u6808\u6ea2\u51fa\u548c\u5185\u5b58\u6ea2\u51fa\u90fd\u662f\u5e38\u89c1\u7684\u9519\u8bef\uff0c\u4f46\u5b83\u4eec\u6709\u7740\u4e0d\u540c\u7684\u539f\u56e0\u548c\u75c7\u72b6\u3002 \u5806\u6808\u6ea2\u51fa \u5806\u6808\u6ea2\u51fa\u53d1\u751f\u5728\u7a0b\u5e8f\u9012\u5f52\u8c03\u7528\u81ea\u8eab\u8fc7\u591a\u6b21\u6570\u65f6\u3002PHP \u89e3\u91ca\u5668\u5728\u6267\u884c\u51fd\u6570\u65f6\u4f1a\u521b\u5efa\u4e00\u4e2a\u5806\u6808\u5e27\uff0c\u5176\u4e2d\u5305\u542b\u5c40\u90e8\u53d8\u91cf\u3001\u53c2\u6570\u548c\u51fd\u6570\u8fd4\u56de\u5730\u5740\u3002\u5f53\u5806\u6808\u53d8\u5f97\u592a\u5927\u4ee5\u81f3\u4e8e\u65e0\u6cd5\u5bb9\u7eb3\u65b0\u7684\u5e27\u65f6\uff0c\u5c31\u4f1a\u53d1\u751f\u5806\u6808\u6ea2\u51fa\u3002 \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b: \u7a0b\u5e8f\u5d29\u6e83\uff0c\u9519\u8bef\u6d88\u606f\u4e3a &#8220;Fatal error: Maximum function nesting level of &#8216;100&#8217; reached, aborting!&#8221; \u5185\u5b58\u6ea2\u51fa \u5185\u5b58\u6ea2\u51fa\u53d1\u751f\u5728\u7a0b\u5e8f\u5206\u914d\u4e86\u6bd4\u53ef\u7528\u5185\u5b58\u66f4\u591a\u7684\u5185\u5b58\u65f6\u3002PHP \u4e2d\u7684\u5185\u5b58\u662f\u7531 PHP \u8fd0\u884c\u65f6\u7ba1\u7406\u7684\uff0c\u5f53\u8fd0\u884c\u65f6\u5c1d\u8bd5\u5206\u914d\u8d85\u8fc7\u5206\u914d\u7ed9 PHP \u7684\u5185\u5b58\u65f6\uff0c\u5c31\u4f1a\u53d1\u751f\u5185\u5b58\u6ea2\u51fa\u3002 \u0441\u0438\u043c\u043f\u0442\u043e\u043c\u044b: \u7a0b\u5e8f\u5d29\u6e83\uff0c\u9519\u8bef\u6d88\u606f\u4e3a &#8220;Fatal error: Out of memory!&#8221; \u5b9e\u6218\u6848\u4f8b \u5806\u6808\u6ea2\u51fa function recurse() { [&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-47094","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47094","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=47094"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47094\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=47094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=47094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=47094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}