收藏

phpstorm 断点调试

2023-01-29  本文已影响0人  暴躁程序员

1. 下载 xdebug 插件,并修改php配置文件

  1. 打开官网下载位置
    此处需要在区域框中输入,phpinfo()打印的信息,根据php的版本信息来确定 xdebug 的版本
https://xdebug.org/wizard
  1. 使用phpinfo()函数来获取 xdebug 对应版本插件
Download php_xdebug-3.1.6-7.4-vc15-x86_64.dll
Move the downloaded file to F:\p\xampp\xampphome\php\ext, and rename it to php_xdebug.dll
Update F:\p\xampp\xampphome\php\php.ini and add the line:
zend_extension = xdebug
Restart the Apache Webserver
zend_extension = xdebug
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_mode = "req"
xdebug.remote_port = 9000
xdebug.idekey = "PHPSTORM"

2. 配置 phpstorm 编辑器

点击右上角下拉框 --> Edit Configurations --> 点击 + 号 --> PHP Web Page

Name                            自定义
Server                          name:自定义,Host:localhost
Start URL                       php文件路径,比如:/mypro/public/index.php
// 在下方显示完整的调试页面地址
点击ok

3. 开启断点调试

点击右上角绿色爬虫图标打开调试页面并进入断点调试

f5键             一步一步进行调试
上一篇 下一篇

猜你喜欢

热点阅读