Sublime配置XDebug

来源:互联网 发布:javascript权威指南6 编辑:程序博客网 时间:2024/06/06 15:45

1.安装XDebug扩展

可以进入XDebug官网下载相应版本的xdebug。如果不能够确定需要选择的版本号,可以打印phpinfo,并且右键查看源码并进行复制。

粘贴到http://xdebug.org/wizard.php,既可以查看到推荐的XDebug版本。

下载dll文件,粘贴到php的ext目录下。并修改php.ini,添加如下:

[XDebug]zend_extension_ts = e:\php\ext\php_xdebug-2.2.3-5.2-vc9.dllxdebug.profiler_enable=onxdebug.trace_output_dir="f:\xdebug"xdebug.profiler_output_dir="f:\xdebug"xdebug.remote_enable = onxdebug.remote_host = 127.0.0.1xdebug.remote_port = 9000

2.Sublime安装xdebug

下载的路径为:https://github.com/martomo/SublimeTextXdebug

下载后的文件夹,放入sublime->preference->browse packages,重启sublime,即可以看到preference->package setting中有xdebug

用ctrl+shift+p调出搜索框,输入xdebug既可以看到xdebug相关的功能


3.firefox安装xdebug

firefox的xdebug扩展为easiest xdebug,路径为:https://addons.mozilla.org/zh-cn/firefox/addon/the-easiest-xdebug/

安装完后,浏览器右下角有个绿色的甲壳虫,点击这个甲壳虫,它有颜色时即为debug状态


4.调试

1.xdebug可以选择watch变量

2.xdebug可以在代码中设置断点

3.xdebug可以start

4.在firefox debug状态下运行,即可以看到断点处的输出;并且可以进行单步调试


快捷键说明如下:

Start/Stop debugging session

  • Start Debugging - Ctrl+Shift+F9 or ⌘+Shift+F9
  • Start Debugging (Launch Browser)
  • Restart Session
  • Stop Debugging - Ctrl+Shift+F10 or ⌘+Shift+F10
  • Stop Debugging (Launch Browser)
  • Stop Debugging (Close Windows)

Breakpoints

  • Add/Remove Breakpoint - Ctrl+F8 or ⌘+F8
  • Set Conditional Breakpoint - Shift+F8
  • Clear Breakpoints
  • Clear All Breakpoints

Watch expressions

  • Set Watch Expression
  • Edit Watch Expression
  • Remove Watch Expression
  • Clear Watch Expressions

Session commands

  • Evaluate
  • Execute
  • Status

Continuation commands

  • Run - Ctrl+Shift+F5 or ⌘+Shift+F5
  • Run To Line
  • Step Over - Ctrl+Shift+F6 or ⌘+Shift+F6
  • Step Into - Ctrl+Shift+F7 or ⌘+Shift+F7
  • Step Out - Ctrl+Shift+F8 or ⌘+Shift+F8
  • Stop
  • Detach

Other

  • Restore Layout / Close Windows - Ctrl+Shift+F11 or ⌘+Shift+F11
  • Settings - Default
  • Settings - User

0 1
原创粉丝点击