Codeigniter + NetBeans + XDebug:重定向()后调试器无法正常工作

jos*_*shi 4 php netbeans codeigniter xdebug netbeans-7

我正在研究一个使用的项目CodeIgniter.我使用Netbeans我的IDE,我已经Xdebug安装.我正在XAMPP用于本地开发.

什么有效: Xdebug工作得很好normal PHP code.

问题:但是,我在调试CodeIgniter项目时遇到问题.调试器在a上停止redirect()

问题详细信息:在netbeans中开始调试项目.调试器启动,我们看到主页.在主页上,有一个与主页控制器中的方法相对应的链接.调试器到达链接指向的控制器中的方法.在这种方法中有一个redirect.在重定向调试器STOPS点.

相关代码片段:

单击的URL(这是标题菜单的一部分)

<a href="<?= base_url("somefunc/"); ?>">Click Me </a>
Run Code Online (Sandbox Code Playgroud)

routes.php - 为更漂亮的网址重新路由.

$route['somefunc'] = "foo/somefunc";
Run Code Online (Sandbox Code Playgroud)

在我的Foo控制器(foo.php)中:

class Foo extends CI_Controller {
    public function somefunc()
    {
        redirect('/bar/otherfunc');  // DEBUGGER REACHES TILL HERE THEN STOPS WORKING
    }
}
Run Code Online (Sandbox Code Playgroud)

如上面评论中所述function somefunc(),Xdebug停止在重定向发生的地方工作.

此外,以下信息可能有一些用处:

config.php文件

$config['uri_protocol'] = 'AUTO'; // I have also tried PATH_INFO, QUERY_STRING, REQUEST_URI & ORIG_PATH_INFO.
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = TRUE; // Have tried FALSE too.
$config['index_page'] = ''; // Tried index.php too.
Run Code Online (Sandbox Code Playgroud)

xdebug设置php.ini

zend_extension ="path\to\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
Run Code Online (Sandbox Code Playgroud)

注意 - 我已经尝试过玩我在这里以及通过谷歌看到的不同建议,但无济于事.有人可以指点我正确的方向吗?

jos*_*shi 9

找到了解决方案.也许这可能会帮助那些一直在努力解决这个问题的人.显然,为了顺利调试,您需要包含以下选项:

xdebug.remote_autostart=1
Run Code Online (Sandbox Code Playgroud)

在你的php.ini.这些设置现在对我有用:

xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
Run Code Online (Sandbox Code Playgroud)

最后一行是我找到的选项(Xdebug官方文档).文件的相关部分如下:

xdebug.remote_autostart

类型:布尔值,默认值:0

通常,您需要使用特定的HTTP GET/POST变量来启动远程调试(请参阅远程调试).当此设置设置为1时,即使GET/POST/COOKIE变量不存在,Xdebug也将始终尝试启动远程调试会话并尝试连接到客户端.