VSCode + PHPXdebug 调试入门 --- 安装篇

# 必备条件
  • VSCode 扩展 PHP Debug
  • VSCode 扩展 Code Runner
# 开始调试
  • 基本配置

    • https://segmentfault.com/a/1190000019475551
  • xdebug调试原理-配置xdebug参数

    • https://www.xiebruce.top/1715.html
    • https://blog.chaosjohn.com/Debug-php-continued.html
  • 排查故障

    • 编辑好test.php后,使用扩展 Code Runner 运行php文件,确认运行正常且能进入debug;
    • 配置 VSCode launch.json
      {
          // 使用 IntelliSense 了解相关属性。 
          // 悬停以查看现有属性的描述。
          // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
          "version": "0.2.0",
          "configurations": [
              {
                  "name": "Listen for XDebug",
                  "type": "php",
                  "request": "launch",
                  "log": true,
                  "port": 9003,
              },
              {
                  "name": "Launch currently open script",
                  "type": "php",
                  "request": "launch",
                  "program": "${file}",
                  "cwd": "${fileDirname}",
                  "log": true,
                  "port": 9000,
              }
          ]
      }
      
    • 集成环境新建php服务,该服务端口需要匹配 launch.json"Launch currently open script" 的配置端口(即:9000)
    • 网页访问 127.0.0.1:9000/test.php (127.0.0.1|localhost)
    • 成功
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

健壮男子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值