PHP - 带有Sublime Text的WAMP / XAMPP上的XDebug - 如何映射到特定页面

时间:2016-10-14 19:51:18

标签: php xdebug

我设置xdebug以在我的WAMP服务器上使用sublime text 3。问题是,当我去:

Tools -> XDebug -> Start Debugging (Launch Window)

每次启动的窗口都是localhost/nutri/。这是一个问题,因为我可能需要调试localhost/nutri/other_page.php所以我这样做:

Tools -> XDebug -> Start Debugging (Launch Window)

例如,假设我需要在localhost/nutri/otherpage.php

上启动调试器

但它会在页面上打开浏览器:

http://localhost/nutri/?XDEBUG_SESSION_START=sublime.xdebug

所以我认为xdebug配置正确:

enter link description here

来自php.ini的继承人:

; XDEBUG Extension
[xdebug]
zend_extension = "c:\\wamp\\bin\\php\\php5.6.19\\zend_ext\\php_xdebug-2.4.1-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_log= "C:\\wamp\\tmp\\xdebug.log"
xdebug.profiler_enable=0
xdebug.profiler_output_dir = "C:\\wamp\\tmp"
xdebug.collect_params = 4
xdebug.collect_return = on
xdebug.collect_vars = on
xdebug.show_local_vars = 3

继承我的崇高文本项目文件:

{
"folders":
[
    {
        "path": "test",
        "follow_symlinks": true,
    },
    {
        "path": "wp-content\\plugins\\genomics",
        "follow_symlinks": true,
    },
    {
        "path": "wp-content\\plugins\\decodify-members",
        "follow_symlinks": true,
    },
    {
        "path": "wp-content\\plugins\\decodify-terminology",
        "follow_symlinks": true,
    },
    {
        "path": "wp-content\\themes\\decodify",
        "follow_symlinks": true,
    }
],

"settings":
{
    "xdebug":
    {
        "url": "http://localhost/nutri/"
    },
    "sublime-view-in-browser": {
         "baseUrl": "http://localhost/nutri",
         "basePath": "C:\\wamp\\www\\nutri"
    }
}

在XDebug配置文件中没有什么真正有趣的:

    // Example:
// "/absolute/path/to/file/on/server" : "/path/to/file/on/computer",
// "/var/www/htdocs/example/" : "C:/git/websites/example/"
"path_mapping": {

},

// Determine which URL to launch in the default web browser
// when starting/stopping a session.
"url": "http://localhost/nutri/",

// An IDE key is used to identify with debugger engine
// when Sublime Text will start or stop a debugging session.
//
// This package does not filter sessions by IDE key,
// it will accept any IDE key, also ones that do not match this configured IDE key.
// It is merely used when launching the default web browser with the configured URL.
"ide_key": "sublime.xdebug",

// Which port number Sublime Text should listen
// to connect with debugger engine.
"port": 9001,

// Show super globals in context view.
"super_globals": true,

// Maximum amount of array children
// and object's properties to return.
"max_children": 32,

// Maximum amount of
// variable data to initially retrieve.
"max_data": 1024,

// Maximum amount of nested levels to retrieve
// of array elements and object properties.
"max_depth": 1,

有没有办法将页面变量添加到xdebug用于加载页面的路径?

编辑:

我设法获得键盘快捷键以启动调试器并同时运行浏览器,方法是将此键绑定添加到我的sublime.keymap文件中:

{
  "keys": ["ctrl+shift+1"], 
  "command": "xdebug_session_start",
  "args": {
    "launch_browser" : true
  }
}

这有很大帮助,但我仍然无法弄清楚如何让它启动正确的文件。它总是在我的项目文件中启动什么:

    "xdebug":
{
    "url": "http://localhost/nutri/"
}

这是我网站的根页面。有没有办法可以添加变量,如:

"url": "http://localhost/nutri/{$file}"

0 个答案:

没有答案