{"id":47068,"date":"2024-12-02T10:22:05","date_gmt":"2024-12-02T02:22:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/47068\/"},"modified":"2024-12-02T10:22:05","modified_gmt":"2024-12-02T02:22:05","slug":"php%e5%87%bd%e6%95%b0%e6%a0%88%e6%ba%a2%e5%87%ba%e9%97%ae%e9%a2%98%e7%9a%84%e6%88%90%e5%9b%a0%e5%8f%8a%e8%a7%84%e9%81%bf%e9%80%94%e5%be%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/47068\/","title":{"rendered":"php\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>php\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84<\/h1>\n<p>\u6b22\u8fce\u5404\u4f4d\u5c0f\u4f19\u4f34\u6765\u5230\u7c73\u4e91\uff0c\u76f8\u805a\u4e8e\u6b64\u90fd\u662f\u7f18\u54c8\u54c8\u54c8\uff01\u4eca\u5929\u6211\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aphp\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84\u300b<\/span>\uff0c\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u8bb2\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\uff0c\u5982\u679c\u4f60\u5bf9<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u77e5\u8bc6\u975e\u5e38\u611f\u5174\u8da3\u6216\u8005\u6b63\u5728\u81ea\u5b66\uff0c\u90fd\u53ef\u4ee5\u5173\u6ce8\u6211\uff0c\u6211\u4f1a\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u6587\u7ae0\uff01\u5f53\u7136\uff0c\u6709\u4ec0\u4e48\u5efa\u8bae\u4e5f\u6b22\u8fce\u5728\u8bc4\u8bba\u7559\u8a00\u63d0\u51fa\uff01\u4e00\u8d77\u5b66\u4e60\uff01<\/p>\n<p>PHP \u51fd\u6570\u6808\u6ea2\u51fa\u662f\u7531\u65e0\u9650\u9012\u5f52\u3001\u6df1\u5c42\u51fd\u6570\u8c03\u7528\u6216\u4f20\u9012\u5927\u578b\u6570\u636e\u5f15\u8d77\u7684\u3002\u89c4\u907f\u9014\u5f84\u5305\u62ec\uff1a\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u5c42\u7ea7\u3001\u4f18\u5316\u53c2\u6570\u3001\u8c03\u9ad8 stack_size \u9650\u5236\uff0c\u4ee5\u53ca\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241025\/1729864180671ba1f440213.jpg\" class=\"aligncenter\" title=\"php\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84\u63d2\u56fe\" alt=\"php\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84\u63d2\u56fe\" \/><\/p>\n<p><strong>PHP \u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84<\/strong><\/p>\n<p><strong>\u6210\u56e0<\/strong><\/p>\n<p>PHP \u51fd\u6570\u6808\u6ea2\u51fa\u662f\u4e00\u79cd\u5e38\u89c1\u7684 PHP \u9519\u8bef\uff0c\u53d1\u751f\u5728 PHP \u51fd\u6570\u8c03\u7528\u5c42\u7ea7\u8fc7\u591a\u65f6\u3002\u6bcf\u4e2a\u51fd\u6570\u8c03\u7528\u90fd\u4f1a\u5728\u51fd\u6570\u6808\u4e2d\u5360\u7528\u7a7a\u95f4\uff0c\u5f53\u6808\u7a7a\u95f4\u6ee1\u65f6\uff0c\u5c31\u4f1a\u89e6\u53d1\u51fd\u6570\u6808\u6ea2\u51fa\u9519\u8bef\u3002<\/p>\n<p><strong>\u5e38\u89c1\u539f\u56e0\uff1a<\/strong><\/p>\n<ul>\n<li>\u65e0\u9650\u9012\u5f52<\/li>\n<li>\u6df1\u5c42\u5d4c\u5957\u7684\u51fd\u6570\u8c03\u7528<\/li>\n<li>\u5927\u578b\u6570\u7ec4\u6216\u5b57\u7b26\u4e32\u7684\u5927\u91cf\u4f20\u9012<\/li>\n<\/ul>\n<p><strong>\u89c4\u907f\u9014\u5f84<\/strong><\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u5c42\u7ea7<\/strong><\/p>\n<ul>\n<li>\u5c06\u590d\u6742\u51fd\u6570\u5206\u89e3\u4e3a\u66f4\u5c0f\u7684\u5b50\u51fd\u6570<\/li>\n<li>\u4f7f\u7528\u51fd\u6570\u5f0f\u7f16\u7a0b\u8303\u5f0f\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u6b21\u6570<\/li>\n<\/ul>\n<p><strong>\u65b9\u6cd5 2\uff1a\u4f18\u5316\u51fd\u6570\u7684\u53c2\u6570<\/strong><\/p>\n<ul>\n<li>\u4ec5\u4f20\u9012\u5fc5\u8981\u7684\u53c2\u6570\uff0c\u907f\u514d\u4f20\u9012\u5927\u578b\u6570\u7ec4\u6216\u5b57\u7b26\u4e32<\/li>\n<li>\u5c3d\u53ef\u80fd\u5c06\u53c2\u6570\u4f20\u9012\u4e3a\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u503c\u4f20\u9012<\/li>\n<\/ul>\n<p><strong>\u65b9\u6cd5 3\uff1a\u8c03\u9ad8 php.ini \u4e2d\u7684 stack_size \u9650\u5236<\/strong><\/p>\n<ul>\n<li>\u5728 php.ini \u914d\u7f6e\u6587\u4ef6\u4e2d\u4fee\u6539 stack_size \u9009\u9879\uff0c\u589e\u52a0\u53ef\u7528\u51fd\u6570\u6808\u7a7a\u95f4<\/li>\n<li>\u6ce8\u610f\uff1a\u63d0\u9ad8 stack_size \u4f1a\u589e\u52a0\u5185\u5b58\u6d88\u8017\uff0c\u5e94\u8c28\u614e\u4f7f\u7528<\/li>\n<\/ul>\n<p><strong>\u65b9\u6cd5 4\uff1a\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316<\/strong><\/p>\n<ul>\n<li>\u5bf9\u4e8e\u9012\u5f52\u51fd\u6570\uff0c\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316\u6280\u672f\uff0c\u5b83\u80fd\u51cf\u5c11\u51fd\u6570\u6808\u7a7a\u95f4\u7684\u5360\u7528<\/li>\n<li>\u5177\u4f53\u65b9\u6cd5\uff1a\u5c06\u9012\u5f52\u8c03\u7528\u653e\u5728\u51fd\u6570\u7684\u6700\u540e\u4e00\u884c<\/li>\n<\/ul>\n<p><strong>\u5b9e\u6218\u6848\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\u6f14\u793a\u4e86\u4e00\u4e2a\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\uff1a<\/p>\n<pre>function factorial($n) {\n  if ($n == 0) {\n    return 1;\n  } else {\n    return $n * factorial($n - 1);  \/\/ \u9012\u5f52\u8c03\u7528\n  }\n}\n\necho factorial(10000);  \/\/ \u51fd\u6570\u6808\u6ea2\u51fa<\/pre>\n<p>\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u53ef\u4ee5\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316\uff1a<\/p>\n<pre>function factorial($n, $result = 1) {\n  if ($n == 0) {\n    return $result;\n  } else {\n    return factorial($n - 1, $result * $n);  \/\/ \u5c3e\u9012\u5f52\u8c03\u7528\n  }\n}\n\necho factorial(10000);  \/\/ \u65e0\u51fd\u6570\u6808\u6ea2\u51fa<\/pre>\n<p>\u901a\u8fc7\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316\uff0c\u6211\u4eec\u5c06\u9012\u5f52\u8c03\u7528\u653e\u5728\u51fd\u6570\u7684\u6700\u540e\u4e00\u884c\uff0c\u6709\u6548\u5730\u51cf\u5c11\u4e86\u51fd\u6570\u6808\u7a7a\u95f4\u7684\u5360\u7528\uff0c\u89e3\u51b3\u4e86\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u3002<\/p>\n<p>\u6587\u4e2d\u5173\u4e8ephp,\u6808\u6ea2\u51fa\u7684\u77e5\u8bc6\u4ecb\u7ecd\uff0c\u5e0c\u671b\u5bf9\u4f60\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff01\u82e5\u662f\u53d7\u76ca\u532a\u6d45\uff0c\u90a3\u5c31\u52a8\u52a8\u9f20\u6807\u6536\u85cf\u8fd9\u7bc7\u300aphp\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84\u300b\u6587\u7ae0\u5427\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u4e86\u89e3\u76f8\u5173\u6280\u672f\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>php\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84 \u6b22\u8fce\u5404\u4f4d\u5c0f\u4f19\u4f34\u6765\u5230\u7c73\u4e91\uff0c\u76f8\u805a\u4e8e\u6b64\u90fd\u662f\u7f18\u54c8\u54c8\u54c8\uff01\u4eca\u5929\u6211\u7ed9\u5927\u5bb6\u5e26\u6765\u300aphp\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84\u300b\uff0c\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u8bb2\u5230\u7b49\u7b49\u77e5\u8bc6\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u76f8\u5173\u7684\u77e5\u8bc6\u975e\u5e38\u611f\u5174\u8da3\u6216\u8005\u6b63\u5728\u81ea\u5b66\uff0c\u90fd\u53ef\u4ee5\u5173\u6ce8\u6211\uff0c\u6211\u4f1a\u6301\u7eed\u66f4\u65b0\u76f8\u5173\u6587\u7ae0\uff01\u5f53\u7136\uff0c\u6709\u4ec0\u4e48\u5efa\u8bae\u4e5f\u6b22\u8fce\u5728\u8bc4\u8bba\u7559\u8a00\u63d0\u51fa\uff01\u4e00\u8d77\u5b66\u4e60\uff01 PHP \u51fd\u6570\u6808\u6ea2\u51fa\u662f\u7531\u65e0\u9650\u9012\u5f52\u3001\u6df1\u5c42\u51fd\u6570\u8c03\u7528\u6216\u4f20\u9012\u5927\u578b\u6570\u636e\u5f15\u8d77\u7684\u3002\u89c4\u907f\u9014\u5f84\u5305\u62ec\uff1a\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u5c42\u7ea7\u3001\u4f18\u5316\u53c2\u6570\u3001\u8c03\u9ad8 stack_size \u9650\u5236\uff0c\u4ee5\u53ca\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316\u3002 PHP \u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\u7684\u6210\u56e0\u53ca\u89c4\u907f\u9014\u5f84 \u6210\u56e0 PHP \u51fd\u6570\u6808\u6ea2\u51fa\u662f\u4e00\u79cd\u5e38\u89c1\u7684 PHP \u9519\u8bef\uff0c\u53d1\u751f\u5728 PHP \u51fd\u6570\u8c03\u7528\u5c42\u7ea7\u8fc7\u591a\u65f6\u3002\u6bcf\u4e2a\u51fd\u6570\u8c03\u7528\u90fd\u4f1a\u5728\u51fd\u6570\u6808\u4e2d\u5360\u7528\u7a7a\u95f4\uff0c\u5f53\u6808\u7a7a\u95f4\u6ee1\u65f6\uff0c\u5c31\u4f1a\u89e6\u53d1\u51fd\u6570\u6808\u6ea2\u51fa\u9519\u8bef\u3002 \u5e38\u89c1\u539f\u56e0\uff1a \u65e0\u9650\u9012\u5f52 \u6df1\u5c42\u5d4c\u5957\u7684\u51fd\u6570\u8c03\u7528 \u5927\u578b\u6570\u7ec4\u6216\u5b57\u7b26\u4e32\u7684\u5927\u91cf\u4f20\u9012 \u89c4\u907f\u9014\u5f84 \u65b9\u6cd5 1\uff1a\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u5c42\u7ea7 \u5c06\u590d\u6742\u51fd\u6570\u5206\u89e3\u4e3a\u66f4\u5c0f\u7684\u5b50\u51fd\u6570 \u4f7f\u7528\u51fd\u6570\u5f0f\u7f16\u7a0b\u8303\u5f0f\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u6b21\u6570 \u65b9\u6cd5 2\uff1a\u4f18\u5316\u51fd\u6570\u7684\u53c2\u6570 \u4ec5\u4f20\u9012\u5fc5\u8981\u7684\u53c2\u6570\uff0c\u907f\u514d\u4f20\u9012\u5927\u578b\u6570\u7ec4\u6216\u5b57\u7b26\u4e32 \u5c3d\u53ef\u80fd\u5c06\u53c2\u6570\u4f20\u9012\u4e3a\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u503c\u4f20\u9012 \u65b9\u6cd5 3\uff1a\u8c03\u9ad8 php.ini \u4e2d\u7684 stack_size \u9650\u5236 \u5728 php.ini \u914d\u7f6e\u6587\u4ef6\u4e2d\u4fee\u6539 stack_size \u9009\u9879\uff0c\u589e\u52a0\u53ef\u7528\u51fd\u6570\u6808\u7a7a\u95f4 \u6ce8\u610f\uff1a\u63d0\u9ad8 stack_size \u4f1a\u589e\u52a0\u5185\u5b58\u6d88\u8017\uff0c\u5e94\u8c28\u614e\u4f7f\u7528 \u65b9\u6cd5 4\uff1a\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316 \u5bf9\u4e8e\u9012\u5f52\u51fd\u6570\uff0c\u4f7f\u7528\u5c3e\u9012\u5f52\u4f18\u5316\u6280\u672f\uff0c\u5b83\u80fd\u51cf\u5c11\u51fd\u6570\u6808\u7a7a\u95f4\u7684\u5360\u7528 \u5177\u4f53\u65b9\u6cd5\uff1a\u5c06\u9012\u5f52\u8c03\u7528\u653e\u5728\u51fd\u6570\u7684\u6700\u540e\u4e00\u884c \u5b9e\u6218\u6848\u4f8b \u4ee5\u4e0b\u4ee3\u7801\u793a\u4f8b\u6f14\u793a\u4e86\u4e00\u4e2a\u51fd\u6570\u6808\u6ea2\u51fa\u95ee\u9898\uff1a function factorial($n) { if ($n == 0) [&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-47068","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47068","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=47068"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47068\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=47068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=47068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=47068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}