【问题标题】:Breakpoint on Vscode not hit with lumen frameworkVscode 上的断点没有被流明框架击中
【发布时间】:2020-06-25 02:14:01
【问题描述】:

当我想调试并查看断点上的数据时遇到问题,它没有被 lumen 框架击中 这是我在 vscode 上的 launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

其他信息 1.安装xdebug v2.9.2 2.vscode版本为1.43.0 3. PHP v7.3.15 4.流明v5.6 5. 两个操作系统我都用XAMPP

以前我使用 windows,在 windows 上会遇到断点,但现在迁移到 macOS 上它不起作用。 在来自另一个项目的 macOS 上,例如,使用 CodeIgniter 或只是简单的 PHP,它会遇到断点。

请帮帮我

【问题讨论】:

    标签: php laravel debugging visual-studio-code lumen


    【解决方案1】:
    1. 先安装 xdebug - [https://xdebug.org/docs/install] 安装
    2. 为 Chrome 安装 Xdebug 助手 - [https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc](为任何其他浏览器使用适当的插件)
    3. 在 Chrome 中的 Xdebug 助手中启用调试模式(或任何其他浏览器的相关插件)
    4. 为 VS Code 安装 PHP 调试扩展 - [https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug]
    5. 服务流明项目php -S localhost:8000 -t public
    6. 打印<?php phpinfo(); ?>,将$router->get('/', function () use ($router) { return phpinfo(); }); 添加到routes/web.php
    7. 如果适用,请评论 $router->get('/' 的退出代码
    8. 在 Chrome 中打开 localhost:8000
    9. 查找 xdebug.ini20-xdebug.ini 或类似名称
    10. 如果文件不存在找到php.ini
    11. 将以下内容添加到 xdebug.iniphp.ini 取决于您的 x-debug 版本 [https://docs.devsense.com/en/vs/debugging/configuring-xdebug]

    Xdebug 2

    [XDEBUG]

    xdebug.remote_enable = on

    xdebug.remote_handler = dbgp

    xdebug.remote_host = 127.0.0.1

    xdebug.remote_port = 9000

    xdebug.remote_mode = req

    xdebug.idekey="php-vs"

    Xdebug 2

    [XDEBUG]

    xdebug.mode=debug

    xdebug.client_host = 127.0.0.1

    xdebug.client_port = 9000

    xdebug.start_with_request=trigger

    1. 再次服务于lument项目php -S localhost:8000 -t public
    2. 最后在 VS Code 中开始调试并检查断点

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-11
      • 1970-01-01
      • 1970-01-01
      • 2022-11-17
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 2019-01-06
      相关资源
      最近更新 更多