在你会浏览这篇文章,说明你已经安装好了VS Code IDE编辑器。
首先需要安装PHP-xdebug扩展文件,先到php-xdebug下载,https://xdebug.org/wizard.php
可以使用phpinfo();查看你当前php版本。


在VS Code中搜索PHP-XDebug插件

打开php安装根目录,编辑php.ini,添加以下内容。
[XDebug]
zend_extension="F:\devloper\php-5.6.30\ext\php_xdebug-2.5.3-5.6-vc11-x86_64.dll"
xdebug.profiler_enable=1
xdebug.remote_autostart = 1
xdebug.profiler_output_dir="F:\devloper\php-5.6.30\tmp"
xdebug.remote_port=9000
xdebug.remote_enable=on
xdebug.remote_handler = dbgp
xdebug.romote_host=localhost

在 phpinfo 中查看 xdebug 扩展的信息,验证是否开启成功

VS Code配置
File—》Preference—》Settings

settings.json文件如下:
{
"php.validate.executablePath": "F:/devloper/php-5.6.30/php.exe"
}


.新建 debug 配置,并选择调试语言

设置断点

浏览器访问后,有断点就跳到VS Code编辑器。


本文详细介绍了如何在VSCode中配置和使用PHP-XDebug插件进行PHP代码的调试过程,包括安装扩展、配置php.ini、VSCode settings及调试配置。
886

被折叠的 条评论
为什么被折叠?



