Sublime Text 配置x-debug
配置php 的x-debug 拓展
下載地址 :http://www.xdebug.org/download.php
放到php ext的目錄下 然后使用再php.ini 中加入extension=php_xdebug.dll
[XDebug] zend_extension = "D:\wampp\php\ext\php_xdebug.dll" xdebug.remote_autostart=1 xdebug.remote_enable = On xdebug.remote_host = "localhost" #本地服務器 xdebug.remote_port = 9001 <strong>#默認為9000,防止與php-fpm沖突,改為9001</strong> xdebug.remote_handler = "dbgp"
下載sublime Text Xdebug插件
下載安裝
下載地址:https://github.com/martomo/SublimeTextXdebug
使用 package control安裝
preference->package Control->install package
配置xdebug client
用sublime 打開你要調試的程序,然后點擊導航的project -》save project as 生成一個.sublime-project的文件 然后配置這個文件
{ "folders": [ { "path": "/D/xampp/htdocs" #這里應該會自動生成 } ], "settings": { "xdebug": { "path_mapping": { }, #本機調試此項不需要設置 "url": "http://localhost/xampp/php.php",#這里為xdebug打開的頁面 "super_globals": true, "close_on_stop": true, "port": 9001 #此port與之前xdebug擴展一致 } } }
調試代碼
- 打斷點 在需要打斷點的行數使用 shift+f8 打斷點
- 開啟debug tools->xdebug->start lance
- 調試代碼 shift+f5