{"id":47388,"date":"2024-12-02T13:16:53","date_gmt":"2024-12-02T05:16:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/47388\/"},"modified":"2024-12-02T13:16:53","modified_gmt":"2024-12-02T05:16:53","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-xdebug-%e6%9d%a5%e5%88%86%e6%9e%90%e5%92%8c%e8%a7%a3%e5%86%b3-php-%e5%a0%86%e6%a0%88%e6%ba%a2%e5%87%ba%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/47388\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p>\u5982\u4f55\u4f7f\u7528 Xdebug \u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\uff1f\u5b89\u88c5 Xdebug \u6269\u5c55\u3002\u914d\u7f6e Xdebug \u6269\u5c55\u3002\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528 Xdebug \u5206\u6790\u5806\u6808\u6ea2\u51fa\uff1a\u8fd0\u884c PHP \u4ee3\u7801\u5e76\u89e6\u53d1\u9519\u8bef\u3002\u6253\u5f00 Xdebug Web \u754c\u9762 (http:\/\/localhost:9000)\u3002\u5728 &#8220;Stacks&#8221; \u9009\u9879\u5361\u4e2d\u68c0\u67e5\u8c03\u7528\u6808\uff0c\u786e\u5b9a\u9012\u5f52\u8c03\u7528\u6216\u65e0\u9650\u5faa\u73af\u3002\u89e3\u51b3\u5806\u6808\u6ea2\u51fa\uff1a\u9650\u5236\u9012\u5f52\u8c03\u7528\u6df1\u5ea6\u3002\u907f\u514d\u65e0\u9650\u5faa\u73af\u3002\u4f18\u5316\u5185\u5b58\u4f7f\u7528\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241026\/1729915299671c69a3a61ae.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898<\/strong><\/p>\n<p><strong>\u7b80\u4ecb<\/strong><\/p>\n<p>PHP \u5806\u6808\u6ea2\u51fa\u9519\u8bef\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u9519\u8bef\uff0c\u5f53\u8c03\u7528\u6808\u8d85\u8fc7\u7cfb\u7edf\u5141\u8bb8\u7684\u6700\u5927\u5927\u5c0f\u65f6\u5c31\u4f1a\u53d1\u751f\u3002\u8fd9\u901a\u5e38\u662f\u7531\u9012\u5f52\u8c03\u7528\u6216\u65e0\u9650\u5faa\u73af\u5f15\u8d77\u7684\u3002<\/p>\n<p>Xdebug \u662f\u4e00\u4e2a\u7528\u4e8e PHP \u8c03\u8bd5\u7684\u6269\u5c55\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5206\u6790\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u5e76\u627e\u5230\u6839\u672c\u539f\u56e0\u3002<\/p>\n<p><strong>\u5b89\u88c5 Xdebug<\/strong><\/p>\n<p>\u9996\u5148\uff0c\u5b89\u88c5 Xdebug \u6269\u5c55\u3002\u4f60\u53ef\u4ee5\u4ece Xdebug \u7f51\u7ad9\u4e0b\u8f7d\u5b83\u5e76\u6309\u7167\u5b89\u88c5\u8bf4\u660e\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u914d\u7f6e Xdebug<\/strong><\/p>\n<p>\u5b89\u88c5\u540e\uff0c\u4f60\u9700\u8981\u5728 <code>php.ini<\/code> \u6587\u4ef6\u4e2d\u914d\u7f6e Xdebug\u3002\u5c06\u4ee5\u4e0b\u884c\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d\uff1a<\/p>\n<pre>zend_extension=\/path\/to\/xdebug.so\nxdebug.remote_enable=1\nxdebug.remote_host=127.0.0.1\nxdebug.remote_port=9000<\/pre>\n<p><strong>\u901a\u8fc7 Xdebug \u5206\u6790\u5806\u6808\u6ea2\u51fa<\/strong><\/p>\n<p>\u8981\u4f7f\u7528 Xdebug \u5206\u6790\u5806\u6808\u6ea2\u51fa\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u8fd0\u884c\u4f60\u7684 PHP \u4ee3\u7801\u5e76\u89e6\u53d1\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u3002<\/li>\n<li>\u6253\u5f00\u4e00\u4e2a Web \u6d4f\u89c8\u5668\uff0c\u5bfc\u822a\u5230 http:\/\/localhost:9000\u3002\u8fd9\u5c06\u6253\u5f00 Xdebug Web \u754c\u9762\u3002<\/li>\n<li>\u5728 &#8220;Stacks&#8221; \u9009\u9879\u5361\u4e2d\uff0c\u4f60\u5c06\u770b\u5230\u5bfc\u81f4\u9519\u8bef\u7684\u51fd\u6570\u8c03\u7528\u6808\u3002<\/li>\n<li>\u68c0\u67e5\u8c03\u7528\u6808\u4ee5\u786e\u5b9a\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u7684\u9012\u5f52\u8c03\u7528\u6216\u65e0\u9650\u5faa\u73af\u3002<\/li>\n<\/ol>\n<p><strong>\u5b9e\u6218\u6848\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u6f14\u793a\u5982\u4f55\u4f7f\u7528 Xdebug \u5206\u6790\u5806\u6808\u6ea2\u51fa\u7684\u5b9e\u6218\u6848\u4f8b\uff1a<\/p>\n<pre>function foo() {\n  foo(); \/\/ \u65e0\u9650\u9012\u5f52\u8c03\u7528\n}\n\nfoo();<\/pre>\n<p>\u8fd0\u884c\u4ee5\u4e0a\u4ee3\u7801\u4f1a\u89e6\u53d1\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u3002\u4f7f\u7528 Xdebug \u5206\u6790\u8c03\u7528\u6808\uff0c\u4f60\u53ef\u4ee5\u770b\u5230 <code>foo()<\/code> \u51fd\u6570\u4e00\u76f4\u88ab\u9012\u5f52\u8c03\u7528\uff0c\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u3002<\/p>\n<p><strong>\u89e3\u51b3\u5806\u6808\u6ea2\u51fa<\/strong><\/p>\n<p>\u4e00\u65e6\u4f60\u786e\u5b9a\u4e86\u5bfc\u81f4\u5806\u6808\u6ea2\u51fa\u7684\u6839\u672c\u539f\u56e0\uff0c\u4f60\u5c31\u53ef\u4ee5\u91c7\u53d6\u63aa\u65bd\u89e3\u51b3\u5b83\uff1a<\/p>\n<ul>\n<li><strong>\u9650\u5236\u9012\u5f52\u8c03\u7528\u7684\u6df1\u5ea6\uff1a<\/strong>\u901a\u8fc7\u6dfb\u52a0\u68c0\u67e5\u6765\u9650\u5236\u9012\u5f52\u8c03\u7528\u7684\u6700\u5927\u6df1\u5ea6\u3002<\/li>\n<li><strong>\u907f\u514d\u65e0\u9650\u5faa\u73af\uff1a<\/strong>\u786e\u4fdd\u4f60\u7684\u5faa\u73af\u4e2d\u6709\u4e00\u4e2a\u7ec8\u6b62\u6761\u4ef6\uff0c\u4ee5\u9632\u6b62\u65e0\u9650\u8fd0\u884c\u3002<\/li>\n<li><strong>\u4f18\u5316\u5185\u5b58\u4f7f\u7528\uff1a<\/strong>\u91ca\u653e\u4e0d\u518d\u9700\u8981\u7684\u53d8\u91cf\u6216\u5bf9\u8c61\uff0c\u4ee5\u51cf\u5c11\u5185\u5b58\u6d88\u8017\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u6b63\u786e\u4f7f\u7528 Xdebug\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5206\u6790\u5e76\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\uff0c\u4ece\u800c\u63d0\u9ad8\u4f60\u7684\u4ee3\u7801\u7684\u53ef\u9760\u6027\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300a\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8eXdebug,PHP \u5806\u6808\u6ea2\u51fa\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898 \u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002 \u5982\u4f55\u4f7f\u7528 Xdebug \u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898\uff1f\u5b89\u88c5 Xdebug \u6269\u5c55\u3002\u914d\u7f6e Xdebug \u6269\u5c55\u3002\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528 Xdebug \u5206\u6790\u5806\u6808\u6ea2\u51fa\uff1a\u8fd0\u884c PHP \u4ee3\u7801\u5e76\u89e6\u53d1\u9519\u8bef\u3002\u6253\u5f00 Xdebug Web \u754c\u9762 (http:\/\/localhost:9000)\u3002\u5728 &#8220;Stacks&#8221; \u9009\u9879\u5361\u4e2d\u68c0\u67e5\u8c03\u7528\u6808\uff0c\u786e\u5b9a\u9012\u5f52\u8c03\u7528\u6216\u65e0\u9650\u5faa\u73af\u3002\u89e3\u51b3\u5806\u6808\u6ea2\u51fa\uff1a\u9650\u5236\u9012\u5f52\u8c03\u7528\u6df1\u5ea6\u3002\u907f\u514d\u65e0\u9650\u5faa\u73af\u3002\u4f18\u5316\u5185\u5b58\u4f7f\u7528\u3002 \u5982\u4f55\u4f7f\u7528 Xdebug \u6765\u5206\u6790\u548c\u89e3\u51b3 PHP \u5806\u6808\u6ea2\u51fa\u95ee\u9898 \u7b80\u4ecb PHP \u5806\u6808\u6ea2\u51fa\u9519\u8bef\u662f\u4e00\u4e2a\u5e38\u89c1\u7684\u9519\u8bef\uff0c\u5f53\u8c03\u7528\u6808\u8d85\u8fc7\u7cfb\u7edf\u5141\u8bb8\u7684\u6700\u5927\u5927\u5c0f\u65f6\u5c31\u4f1a\u53d1\u751f\u3002\u8fd9\u901a\u5e38\u662f\u7531\u9012\u5f52\u8c03\u7528\u6216\u65e0\u9650\u5faa\u73af\u5f15\u8d77\u7684\u3002 Xdebug \u662f\u4e00\u4e2a\u7528\u4e8e PHP \u8c03\u8bd5\u7684\u6269\u5c55\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5206\u6790\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u5e76\u627e\u5230\u6839\u672c\u539f\u56e0\u3002 \u5b89\u88c5 Xdebug \u9996\u5148\uff0c\u5b89\u88c5 Xdebug \u6269\u5c55\u3002\u4f60\u53ef\u4ee5\u4ece Xdebug \u7f51\u7ad9\u4e0b\u8f7d\u5b83\u5e76\u6309\u7167\u5b89\u88c5\u8bf4\u660e\u8fdb\u884c\u64cd\u4f5c\u3002 \u914d\u7f6e Xdebug \u5b89\u88c5\u540e\uff0c\u4f60\u9700\u8981\u5728 php.ini \u6587\u4ef6\u4e2d\u914d\u7f6e Xdebug\u3002\u5c06\u4ee5\u4e0b\u884c\u6dfb\u52a0\u5230\u6587\u4ef6\u4e2d\uff1a zend_extension=\/path\/to\/xdebug.so [&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-47388","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47388","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=47388"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/47388\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=47388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=47388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=47388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}