[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"app-article-1":3,"mdc-etaj4q-key":22},{"code":4,"message":5,"data":6},200,"success",{"id":7,"category_id":7,"title":8,"author":9,"image":10,"describe":11,"content":12,"views":13,"sort":14,"status":7,"is_link":15,"link_url":16,"is_hot":15,"created_by":7,"updated_by":17,"create_time":18,"update_time":19,"username":20,"avatar":21},1,"PHP 开发者必备：深入理解与使用 Xdebug 断点调试","saithink","https://image.saithink.top/storage/20260410/a5c069dca6e2f1be38c21bec1e97f39035d38209.jpg","详细介绍PHP在webman下如何使用Xdebug进行调试","\u003Ch2>一、 为什么要使用 Xdebug？\u003C/h2>\u003Cp> &nbsp; &nbsp;很多 PHP 开发者习惯使用 \u003Ccode>echo\u003C/code>、\u003Ccode>print_r\u003C/code> 或 \u003Ccode>var_dump\u003C/code> 来调试代码。虽然简单，但在处理逻辑复杂的循环、深层嵌套的对象或异步请求时，这种方法效率极低。\u003C/p>\u003Cp>\u003Cstrong>Xdebug\u003C/strong> 的出现将调试从“猜谜游戏”变成了“手术刀式的精准观察”。\u003C/p>\u003Ch2>二、如何安装Xdebug调试工具\u003C/h2>\u003Cp>1、在php里面开启Xdebug扩展，使用的是【FlyEnv】开发环境管理器\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/3ede1ad26168549f3e7e129d263595fc665dc28d.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/3ede1ad26168549f3e7e129d263595fc665dc28d.png\" style=\"\"/>\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/86fb7641d6d058828a697b1e83dec9ac9e4fbf11.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/86fb7641d6d058828a697b1e83dec9ac9e4fbf11.png\" style=\"\"/>\u003C/p>\u003Cp>2、在VSCODE 里面安装扩展工具，并且配置相关命令\u003C/p>\u003Cp>在vscode插件市场里面找到 php debug 这个插件并进行安装\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/8c672c740904e03ba14269a54b17b1a6047ad9dd.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/8c672c740904e03ba14269a54b17b1a6047ad9dd.png\" style=\"\"/>\u003C/p>\u003Cp>配置php路径\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/dc37c2a9677a69348c72374a4c1888821d31bb32.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/dc37c2a9677a69348c72374a4c1888821d31bb32.png\" style=\"\"/>\u003C/p>\u003Cp>在settings.json里面配置php的运行路径，包含exe文件\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/95e19a5e12c61527058bcfa251cf3125e2771251.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/95e19a5e12c61527058bcfa251cf3125e2771251.png\" style=\"\"/>\u003C/p>\u003Cp>在项目根目录的.vscode里面，加入lanuch.json，配置如下\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/5c97683b18f50762d8a378527de87e19c8d17a51.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/5c97683b18f50762d8a378527de87e19c8d17a51.png\" style=\"\"/>\u003C/p>\u003Cpre>\u003Ccode class=\"language-javascript\">{\r\n    \"version\": \"0.2.0\",\r\n    \"configurations\": [\r\n        {\r\n            \"name\": \"Listen for Xdebug\",\r\n            \"type\": \"php\",\r\n            \"request\": \"launch\",\r\n            \"port\": 9003,\r\n            \"stopOnEntry\": false\r\n        }\r\n    ]\r\n}\u003C/code>\u003C/pre>\u003Cp>3、启动调试\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/f896163e9d2c94b48c1ce4e9a759b56911b9e794.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/f896163e9d2c94b48c1ce4e9a759b56911b9e794.png\" style=\"\"/>\u003C/p>\u003Cp>启动webman\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/73f3d4e98c6d2c3acbc054378a6b822cb2624bdf.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/73f3d4e98c6d2c3acbc054378a6b822cb2624bdf.png\" style=\"\"/>\u003C/p>\u003Cp>浏览器访问这个接口\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/ffb709d74b09d9cef2239a253b702455c3c58cd1.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/ffb709d74b09d9cef2239a253b702455c3c58cd1.png\" style=\"\"/>\u003C/p>\u003Cp>程序进入了调试\u003C/p>\u003Cp>\u003Cimg src=\"https://image.saithink.top/storage/20260410/2be5ab24c41e70694ad54ee56205fb6ab07c77fd.png\" alt=\"image.png\" data-href=\"https://image.saithink.top/storage/20260410/2be5ab24c41e70694ad54ee56205fb6ab07c77fd.png\" style=\"\"/>\u003C/p>",516,100,2,"",34,"2024-06-02 22:55:25","2026-05-01 04:53:29","admin","https://image.saithink.top/storage/20260410/7971881d7e10a122e0f51ea188571dbe29d82229.jpg",{"data":23,"body":24},{},{"type":25,"children":26},"root",[27,36,64,75,81,86,95,102,107,112,119,124,131,136,143,148,155,166,171,178,183,190,195,202,207],{"type":28,"tag":29,"props":30,"children":32},"element","h2",{"id":31},"一-为什么要使用-xdebug",[33],{"type":34,"value":35},"text","一、 为什么要使用 Xdebug？",{"type":28,"tag":37,"props":38,"children":39},"p",{},[40,42,48,50,55,57,62],{"type":34,"value":41},"    很多 PHP 开发者习惯使用 ",{"type":28,"tag":43,"props":44,"children":45},"code",{},[46],{"type":34,"value":47},"echo",{"type":34,"value":49},"、",{"type":28,"tag":43,"props":51,"children":52},{},[53],{"type":34,"value":54},"print_r",{"type":34,"value":56}," 或 ",{"type":28,"tag":43,"props":58,"children":59},{},[60],{"type":34,"value":61},"var_dump",{"type":34,"value":63}," 来调试代码。虽然简单，但在处理逻辑复杂的循环、深层嵌套的对象或异步请求时，这种方法效率极低。",{"type":28,"tag":37,"props":65,"children":66},{},[67,73],{"type":28,"tag":68,"props":69,"children":70},"strong",{},[71],{"type":34,"value":72},"Xdebug",{"type":34,"value":74}," 的出现将调试从“猜谜游戏”变成了“手术刀式的精准观察”。",{"type":28,"tag":29,"props":76,"children":78},{"id":77},"二如何安装xdebug调试工具",[79],{"type":34,"value":80},"二、如何安装Xdebug调试工具",{"type":28,"tag":37,"props":82,"children":83},{},[84],{"type":34,"value":85},"1、在php里面开启Xdebug扩展，使用的是【FlyEnv】开发环境管理器",{"type":28,"tag":37,"props":87,"children":88},{},[89],{"type":28,"tag":90,"props":91,"children":94},"img",{"src":92,"alt":93,"dataHref":92,"style":16},"https://image.saithink.top/storage/20260410/3ede1ad26168549f3e7e129d263595fc665dc28d.png","image.png",[],{"type":28,"tag":37,"props":96,"children":97},{},[98],{"type":28,"tag":90,"props":99,"children":101},{"src":100,"alt":93,"dataHref":100,"style":16},"https://image.saithink.top/storage/20260410/86fb7641d6d058828a697b1e83dec9ac9e4fbf11.png",[],{"type":28,"tag":37,"props":103,"children":104},{},[105],{"type":34,"value":106},"2、在VSCODE 里面安装扩展工具，并且配置相关命令",{"type":28,"tag":37,"props":108,"children":109},{},[110],{"type":34,"value":111},"在vscode插件市场里面找到 php debug 这个插件并进行安装",{"type":28,"tag":37,"props":113,"children":114},{},[115],{"type":28,"tag":90,"props":116,"children":118},{"src":117,"alt":93,"dataHref":117,"style":16},"https://image.saithink.top/storage/20260410/8c672c740904e03ba14269a54b17b1a6047ad9dd.png",[],{"type":28,"tag":37,"props":120,"children":121},{},[122],{"type":34,"value":123},"配置php路径",{"type":28,"tag":37,"props":125,"children":126},{},[127],{"type":28,"tag":90,"props":128,"children":130},{"src":129,"alt":93,"dataHref":129,"style":16},"https://image.saithink.top/storage/20260410/dc37c2a9677a69348c72374a4c1888821d31bb32.png",[],{"type":28,"tag":37,"props":132,"children":133},{},[134],{"type":34,"value":135},"在settings.json里面配置php的运行路径，包含exe文件",{"type":28,"tag":37,"props":137,"children":138},{},[139],{"type":28,"tag":90,"props":140,"children":142},{"src":141,"alt":93,"dataHref":141,"style":16},"https://image.saithink.top/storage/20260410/95e19a5e12c61527058bcfa251cf3125e2771251.png",[],{"type":28,"tag":37,"props":144,"children":145},{},[146],{"type":34,"value":147},"在项目根目录的.vscode里面，加入lanuch.json，配置如下",{"type":28,"tag":37,"props":149,"children":150},{},[151],{"type":28,"tag":90,"props":152,"children":154},{"src":153,"alt":93,"dataHref":153,"style":16},"https://image.saithink.top/storage/20260410/5c97683b18f50762d8a378527de87e19c8d17a51.png",[],{"type":28,"tag":156,"props":157,"children":158},"pre",{},[159],{"type":28,"tag":43,"props":160,"children":163},{"className":161},[162],"language-javascript",[164],{"type":34,"value":165},"{\n    \"version\": \"0.2.0\",\n    \"configurations\": [\n        {\n            \"name\": \"Listen for Xdebug\",\n            \"type\": \"php\",\n            \"request\": \"launch\",\n            \"port\": 9003,\n            \"stopOnEntry\": false\n        }\n    ]\n}",{"type":28,"tag":37,"props":167,"children":168},{},[169],{"type":34,"value":170},"3、启动调试",{"type":28,"tag":37,"props":172,"children":173},{},[174],{"type":28,"tag":90,"props":175,"children":177},{"src":176,"alt":93,"dataHref":176,"style":16},"https://image.saithink.top/storage/20260410/f896163e9d2c94b48c1ce4e9a759b56911b9e794.png",[],{"type":28,"tag":37,"props":179,"children":180},{},[181],{"type":34,"value":182},"启动webman",{"type":28,"tag":37,"props":184,"children":185},{},[186],{"type":28,"tag":90,"props":187,"children":189},{"src":188,"alt":93,"dataHref":188,"style":16},"https://image.saithink.top/storage/20260410/73f3d4e98c6d2c3acbc054378a6b822cb2624bdf.png",[],{"type":28,"tag":37,"props":191,"children":192},{},[193],{"type":34,"value":194},"浏览器访问这个接口",{"type":28,"tag":37,"props":196,"children":197},{},[198],{"type":28,"tag":90,"props":199,"children":201},{"src":200,"alt":93,"dataHref":200,"style":16},"https://image.saithink.top/storage/20260410/ffb709d74b09d9cef2239a253b702455c3c58cd1.png",[],{"type":28,"tag":37,"props":203,"children":204},{},[205],{"type":34,"value":206},"程序进入了调试",{"type":28,"tag":37,"props":208,"children":209},{},[210],{"type":28,"tag":90,"props":211,"children":213},{"src":212,"alt":93,"dataHref":212,"style":16},"https://image.saithink.top/storage/20260410/2be5ab24c41e70694ad54ee56205fb6ab07c77fd.png",[]]