本篇内容主要讲解“VSCode怎么调试PhpStudy里的代码”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“VSCode怎么调试PhpStudy里的代码”吧!
配置 PhpStudy
我使用的是WNMP环境,web服务器是
NginxApache使用默认版本PHP
使用默认版本的PHP就相当简单了,直接打开
XDebug调试组件配置好了就可以跳过下面的部分,直接去看 配置 VS Code 。
使用自定义版本PHP
要不说我这个人做东西怎么慢呢,因为经常想要知道
为什么别的方法下载新版PHP
先到官方网站下载最新的
PHP 7.4.33ntsX:path	ophpstudy_proExtensionsphpphp-7.4.33nts下载并配置XDebug
刚才下载的包里是不包含
XDebugXDebugphp_info把下载好的dll插件拷贝到刚才
php-7.4.33ntsextphp.iniOPCache[XDebug]
zend_extension="D:phpstudy_proExtensionsphpphp-7.4.33ntsextphp_xdebug.dll"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.remote_autostart = 1
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=On
xdebug.remote_enable=On
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
记得把
zend_extension测试配置是否成功
首先重启web服务器(无论 Nginx 还是 Apache),然后用
phpinfo()XDebug配置 VS Code
确保 VSCode 中已经下载
PHP Debug打开 文件->首选项->设置 , 在配置中添加如下内容:
"php.validate.executablePath": "D:/phpstudy_pro/Extensions/php/php-7.4.33nts/php.exe"
最后直接点击 *运行和调试* 按钮,在创建的
launch.json{
    "name": "Listen for Xdebug",
    "type": "php",
    "request": "launch",
    "port": 9000
}
以上就是VSCode怎么调试PhpStudy里的代码的详细内容,更多关于VSCode怎么调试PhpStudy里的代码的资料请关注九品源码其它相关文章!