一、下载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

二、 vs code 下载插件 PHP Debug

需要配置 launch.json 注意port 是 你xdebug 的port 我的是默认 9003,其它应该不需要改动

三 chrome 下载 Xdebug helper (需科学上网)

四 调试
chrome 启动 xdebug helper ,debug 模式

测试在 VSCode 里面使用

[gif效果链接]https://attachment.wampserver.site/images/2021/06/16/f52edcedaaf34666cb00ae6c38a5208b.gif
ps: phpstorm 也可以用php.ini 的配置 ,之前用phpstrom 一直调试不成功,改了php.ini的配置 如上后,也可以调试成功了。
网友评论