一、下载xdebug
然后在 /Applications/XAMPP/xamppfiles/etc/php.ini
最后加上
[xdebug]
zend_extension = "/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20210902/xdebug.so"
xdebug.mode = develop,debug
xdebug.remote_enable=1
xdebug.client_port=9003
xdebug.client_host=127.0.0.1
xdebug.remote_autostart=1
xdebug.start_with_request = yes
![](https://img.haomeiwen.com/i2384741/cdbcb18dc108472d.png)
二、 vs code 下载插件 PHP Debug
![](https://img.haomeiwen.com/i2384741/77802f03ea2f9cf3.png)
需要配置 launch.json 注意port 是 你xdebug 的port 我的是默认 9003,其它应该不需要改动
![](https://img.haomeiwen.com/i2384741/5265205dede50c2f.png)
三 chrome 下载 Xdebug helper (需科学上网)
![](https://img.haomeiwen.com/i2384741/cabc137912af883c.png)
四 调试
chrome 启动 xdebug helper ,debug 模式
![](https://img.haomeiwen.com/i2384741/3ee798953f89524b.png)
测试在 VSCode 里面使用
![](https://img.haomeiwen.com/i2384741/bebc77c470d063b3.gif)
[gif效果链接]https://attachment.wampserver.site/images/2021/06/16/f52edcedaaf34666cb00ae6c38a5208b.gif
ps: phpstorm 也可以用php.ini 的配置 ,之前用phpstrom 一直调试不成功,改了php.ini的配置 如上后,也可以调试成功了。
网友评论