1、在項(xiàng)目中打印phpinfo();右鍵查看源碼,并復(fù)制源碼到
https://xdebug.org/wizard

image.png
然后點(diǎn)擊紅色框的按鈕。

image.png
下載該擴(kuò)展。并將其移動(dòng)到指定文件下。

image.png

image.png
在對(duì)應(yīng)的版本下的php.ini中最下方添加下面字符串
[XDebug]
;xdebug地址
zend_extension="C:\phpstudy\PHPTutorial\php\php-7.1.13-nts\ext\php_xdebug-2.7.0-7.1-vc14-nts.dll"
xdebug.remote_enable=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
;phpstorm開(kāi)啟的端口號(hào)
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
此時(shí)重啟服務(wù)可以看到phpinfo()中的xdebug

image.png
2、進(jìn)入phpstorm,打開(kāi)設(shè)置,并填寫該端口號(hào),該端口號(hào)與上面在php.ini中配置的一致

image.png
進(jìn)入server。并填寫信息。

image.png
在phpstorm右上方可以看到edit confi..... 我這里是配置好的

image.png
點(diǎn)進(jìn)去,并配置

image.png
瀏覽器我這邊選擇默認(rèn)的瀏覽器。
3、選擇斷點(diǎn),點(diǎn)擊小蟲(chóng)即可。此時(shí)會(huì)默認(rèn)打開(kāi)瀏覽器但是無(wú)法全加載,此時(shí)即進(jìn)入了調(diào)試。
點(diǎn)擊下圖的紅色框即走下一步,在phpstorm中可看到變量等信息。

image.png

image.png