標籤:
1.搭建php本地運行環境具體點擊如何使用phpstudy本地搭建多網站(每個網站對應不同的連接埠)
2.下載php_xdebug.dll,
【5.3版以上的php】http://pecl.php.net/package/xdebug
【5.3版及其以下的php】http://pecl.php.net/package/xdebug/2.2.7/windows
注意版本要對應,不然可能會不能用。
3.安裝php xdebug擴充(即在配置php.ini檔案加入以下代碼)
[XDebug] zend_extension = "D:\phpStudy\php53n\ext\xdebug\php_xdebug.dll" xdebug.remote_enable = on xdebug.remote_handler = "dbgp" xdebug.remote_host = "127.0.0.1" xdebug.remote_port = 9000
D:\phpStudy\php53n\ext\xdebug\php_xdebug.dll這個路徑僅供參考,具體按你本地存放的路徑為主。
在本地測試環境中建立個php檔案,裡面鍵入
<?php
phpinfo();
?>
然後瀏覽器中查看該頁面,
如執行結果有類似紅框處的代碼則表示php xdebug擴充安裝成功,否則自己再檢查下以上哪一步出問題了。
4.為Google瀏覽器安裝Xdebug helper 1.4.2擴充(去百度搜尋下載並安裝即可),安裝結束後如下:
安裝瀏覽器外掛程式 調試php
安裝chrome外掛程式.Xdebug helper 配置xdebug helper .開啟chrome擴充選項.
配置:
儲存,重啟下chrome
5.在sublime text 快速鍵ctrl+shift+p 打package control 輸入install 斷行符號確認。 :
6.sublime 開啟一個.php檔案.隨便選擇一行 按ctrl+ f8 設定一個斷點,刪除斷點的快速鍵也是ctrl+ f8
開啟chrome 輸入localhost/php101/test.php 我的樣本地址,:
點擊chrome瀏覽器地址欄中的xdebug外掛程式並選擇第一項。
回到sublime的php代碼介面按Ctrl+Shift+F9啟動調試,回到chrome按F5重新整理,然後到sublime介面會看到如調試代碼
按ctrl+shif+F5執行到下個語句,ctrl+shif+F6執行到下個斷點。
sublime退出xdebug按shift+alt+1
如何在sublime+chrome中調試php代碼?