首先是安裝好PHP之后配置環境變量
然后在cmd中輸入php -v 能看到版本號即為配置好了
之后在sublime中新建編譯系統,輸入代碼
{ "cmd": ["php", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.php" }
然后保存在默認位置,改名字為php.sublime-build 然后就好了,輸入簡單的php語句按Ctrl+B就能看見結果了。
之后進行Xdebug的安裝
我們先去查看php.ini的內容新建一個php文件只寫一個phpinfo()函數
<?php phpinfo(); ?>
然后用瀏覽器運行(wampserver要放到www里面用localhost/…去訪問)然后可以看到
然后右鍵查看源碼,然后將所有代碼復制到這里https://xdebug.org/wizard.php去分析php所對應的xdebug版本
最下面會讓你下載對應的版本以及需要將其放到哪里,修改什么內容,如果是使用wampserver的可以點左下角的圖標,php里面的php.ini打開進行修改,由于wampserver里面本身會有一些xdebug的配置,我們可以注釋掉,最終的配置如下:
[xdebug] zend_extension = E:\wamp64\bin\php\php5.6.19\ext\php_xdebug-2.4.0-5.6-vc11-x86_64.dll xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 ;xdebug.remote_enable = off ;xdebug.profiler_enable = off ;xdebug.profiler_enable_trigger = off ;xdebug.profiler_output_name = cachegrind.out.%t.%p ;xdebug.profiler_output_dir ="E:/wamp64/tmp" ;xdebug.show_local_vars=0
之后重啟所有服務器之后,在sublime中用package conctrol下載xdebug client 然后就可以調試了
- Shift+f8: 打開調試面板
- f8:打開調試面板快速連接
- Ctrl+f8: 切換斷點
- Ctrl+Shift+f5: 運行到下一個斷點
- Ctrl+Shift+f6: 單步
- Ctrl+Shift+f7: 步入
- Ctrl+Shift+f8: 步出
chrome 上可以安一個xdebug helper這樣就能在網頁上進行調試了
原文鏈接:https://blog.csdn.net/u010574567/article/details/52074231