{"id":7706,"date":"2024-11-14T08:28:22","date_gmt":"2024-11-14T00:28:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7706\/"},"modified":"2024-11-14T08:28:22","modified_gmt":"2024-11-14T00:28:22","slug":"php-%e4%b8%ad%e7%9a%84%e6%8a%91%e5%88%b6%e7%ac%a6%e4%b8%ba%e4%bd%95%e6%97%a0%e6%b3%95%e9%9a%90%e8%97%8f%e6%95%b0%e6%8d%ae%e5%ba%93%e8%bf%9e%e6%8e%a5%e8%87%b4%e5%91%bd%e9%94%99","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7706\/","title":{"rendered":"PHP \u4e2d\u7684\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u6570\u636e\u5e93\u8fde\u63a5\u81f4\u547d\u9519\u8bef\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173115513070562.jpg\" class=\"aligncenter\" title=\"PHP \u4e2d\u7684\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u6570\u636e\u5e93\u8fde\u63a5\u81f4\u547d\u9519\u8bef\uff1f\u63d2\u56fe\" alt=\"PHP \u4e2d\u7684\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u6570\u636e\u5e93\u8fde\u63a5\u81f4\u547d\u9519\u8bef\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u9519\u8bef\u4fe1\u606f<\/strong><\/p>\n<p>\u5728 php \u4e2d\uff0c\u9519\u8bef\u6291\u5236\u7b26\u201c@\u201d\u53ef\u7528\u4e8e\u6291\u5236\u9519\u8bef\u548c\u8b66\u544a\u6d88\u606f\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u6570\u636e\u5e93\u8fde\u63a5\u7b49\u4f1a\u629b\u51fa\u81f4\u547d\u9519\u8bef (fatal error) \u7684\u64cd\u4f5c\uff0c\u201c@\u201d\u6291\u5236\u7b26\u5c06\u4e0d\u518d\u8d77\u4f5c\u7528\u3002<\/p>\n<p><strong>\u539f\u56e0\uff1a<\/strong><\/p>\n<p>\u81ea php 8.0 \u5f00\u59cb\uff0c\u81f4\u547d\u9519\u8bef\u4e0d\u518d\u88ab\u201c@\u201d\u6291\u5236\u5668\u6291\u5236\u3002\u8fd9\u662f\u7531\u4e8e\u81f4\u547d\u9519\u8bef\u88ab\u8ba4\u4e3a\u662f\u4e25\u91cd\u7684\u9519\u8bef\uff0c\u53ef\u80fd\u5bfc\u81f4\u7a0b\u5e8f\u7ec8\u6b62\uff0c\u56e0\u6b64 php \u6838\u5fc3\u56e2\u961f\u51b3\u5b9a\u505c\u6b62\u6291\u5236\u6b64\u7c7b\u9519\u8bef\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u5458\u80fd\u591f\u53ca\u65f6\u4e86\u89e3\u5e76\u89e3\u51b3\u8fd9\u4e9b\u4e25\u91cd\u95ee\u9898\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u4ed4\u7ec6\u68c0\u67e5\u60a8\u7684\u6570\u636e\u5e93\u8fde\u63a5\u51ed\u636e\u5e76\u786e\u4fdd\u5176\u6b63\u786e\u65e0\u8bef\u3002\u53e6\u4e00\u79cd\u66ff\u4ee3\u65b9\u6cd5\u662f\u4f7f\u7528 php \u5f02\u5e38\u5904\u7406\u673a\u5236\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 try-catch \u5757\u6765\u6355\u83b7\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38\uff1a<\/p>\n<pre>try {\n    \/\/ \u8fde\u63a5\u6570\u636e\u5e93\n} catch (Exception $e) {\n    \/\/ \u5904\u7406\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u65b9\u6cd5\u4ecd\u4f1a\u663e\u793a\u4e00\u4e2a\u9519\u8bef\u6d88\u606f\uff0c\u4f46\u5b83\u5c06\u662f\u66f4\u51c6\u786e\u4e14\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u9519\u8bef\u6d88\u606f\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u5feb\u5730\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fPHP \u4e2d\u7684\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u6570\u636e\u5e93\u8fde\u63a5\u81f4\u547d\u9519\u8bef\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u9519\u8bef\u4fe1\u606f \u5728 php \u4e2d\uff0c\u9519\u8bef\u6291\u5236\u7b26\u201c@\u201d\u53ef\u7528\u4e8e\u6291\u5236\u9519\u8bef\u548c\u8b66\u544a\u6d88\u606f\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u6570\u636e\u5e93\u8fde\u63a5\u7b49\u4f1a\u629b\u51fa\u81f4\u547d\u9519\u8bef (fatal error) \u7684\u64cd\u4f5c\uff0c\u201c@\u201d\u6291\u5236\u7b26\u5c06\u4e0d\u518d\u8d77\u4f5c\u7528\u3002 \u539f\u56e0\uff1a \u81ea php 8.0 \u5f00\u59cb\uff0c\u81f4\u547d\u9519\u8bef\u4e0d\u518d\u88ab\u201c@\u201d\u6291\u5236\u5668\u6291\u5236\u3002\u8fd9\u662f\u7531\u4e8e\u81f4\u547d\u9519\u8bef\u88ab\u8ba4\u4e3a\u662f\u4e25\u91cd\u7684\u9519\u8bef\uff0c\u53ef\u80fd\u5bfc\u81f4\u7a0b\u5e8f\u7ec8\u6b62\uff0c\u56e0\u6b64 php \u6838\u5fc3\u56e2\u961f\u51b3\u5b9a\u505c\u6b62\u6291\u5236\u6b64\u7c7b\u9519\u8bef\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u5458\u80fd\u591f\u53ca\u65f6\u4e86\u89e3\u5e76\u89e3\u51b3\u8fd9\u4e9b\u4e25\u91cd\u95ee\u9898\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u89e3\u51b3\u65b9\u6cd5\uff1a \u4e3a\u4e86\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u8bf7\u4ed4\u7ec6\u68c0\u67e5\u60a8\u7684\u6570\u636e\u5e93\u8fde\u63a5\u51ed\u636e\u5e76\u786e\u4fdd\u5176\u6b63\u786e\u65e0\u8bef\u3002\u53e6\u4e00\u79cd\u66ff\u4ee3\u65b9\u6cd5\u662f\u4f7f\u7528 php \u5f02\u5e38\u5904\u7406\u673a\u5236\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 try-catch \u5757\u6765\u6355\u83b7\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38\uff1a try { \/\/ \u8fde\u63a5\u6570\u636e\u5e93 } catch (Exception $e) { \/\/ \u5904\u7406\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38 } \u767b\u5f55\u540e\u590d\u5236 \u6b64\u65b9\u6cd5\u4ecd\u4f1a\u663e\u793a\u4e00\u4e2a\u9519\u8bef\u6d88\u606f\uff0c\u4f46\u5b83\u5c06\u662f\u66f4\u51c6\u786e\u4e14\u66f4\u5bb9\u6613\u7406\u89e3\u7684\u9519\u8bef\u6d88\u606f\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u5feb\u5730\u89e3\u51b3\u95ee\u9898\u3002 \u4ee5\u4e0a\u5c31\u662fPHP \u4e2d\u7684\u201c@\u201d\u6291\u5236\u7b26\u4e3a\u4f55\u65e0\u6cd5\u9690\u85cf\u6570\u636e\u5e93\u8fde\u63a5\u81f4\u547d\u9519\u8bef\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-7706","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7706","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=7706"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7706\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}