码迷,mamicode.com
首页 > 其他好文 > 详细

vscode增加xdebug扩展

时间:2016-11-26 14:33:51      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:span   包括   2.0   open   deb   out   安装位置   查看   oca   

  • 首先确保php增加了xdebug扩展,方法很多,百度一下。可通过phpinfo()查看是否已开启支持。
[xdebug]
; XDEBUG Extension
zend_extension = "C:/phpStudy/php56n/ext/php_xdebug-2.4.0-5.6-vc11-nts.dll"
xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "D:/WWW/tmp"
xdebug.show_local_vars=0
;启用远程调试
xdebug.remote_autostart= 1
  • C:/phpStudy/php56n/ext/php_xdebug-2.4.0-5.6-vc11-nts.dll 根据安装位置自定义设置
  • ctrl+shift+D 打开调试,点击小齿轮,选择相对应的语言(我这选择php),下拉框选择listen to xdebug
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}
  • 鼠标在代码行号左边点击设置断点,F5,启动调试。
  • 在浏览器中输入相对应的访问地址,在调试-变量出即可看到断点的结果值

NOTICE:

  • php安装xdebug一直失败,最终发现是下载的 php_xdebug-2.4.0rc4-5.6-vc11-x86_64.dll 有误,改为nts后成功, php_xdebug-2.4.0-5.6-vc11-nts.dll 安装上后成功!
  • 断点使用:vscode中F5开启断点,在浏览器中访问后,将会直接跳至vscode中,按f5即可不断按照断点运行/停止。断点-变量中显示的数据是设置断点行之前的数据信息,不包括本行!
  • 安装后可能与其他编辑器的xdebug冲突,比如zendstudio默认含有xdebug插件,解决办法:更改zendstudio中xdebug插件的端口号,默认9000
 

vscode增加xdebug扩展

标签:span   包括   2.0   open   deb   out   安装位置   查看   oca   

原文地址:http://www.cnblogs.com/wanghaokun/p/6103894.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!