【发布时间】:2013-06-13 14:40:30
【问题描述】:
我正在做一个使用CodeIgniter 的项目。我使用Netbeans 作为我的IDE,并且我安装了Xdebug。我正在使用XAMPP 进行本地开发。
工作原理: Xdebug 对normal PHP code. 工作正常
问题:但是,我在调试CodeIgniter 项目时遇到了问题。调试器在 redirect() 处停止
问题详情: 在 netbeans 中启动调试项目。调试器启动,我们看到主页。在主页上,有一个链接对应于主页控制器中的方法。 调试器到达链接指向的控制器中的方法。在这个方法中有一个redirect。 重定向调试器停止。
相关代码片段:
被点击的 URL(这是标题菜单的一部分)
<a href="<?= base_url("somefunc/"); ?>">Click Me </a>
routes.php - 为更漂亮的 url 重新路由。
$route['somefunc'] = "foo/somefunc";
在我的 Foo 控制器 (foo.php) 中:
class Foo extends CI_Controller {
public function somefunc()
{
redirect('/bar/otherfunc'); // DEBUGGER REACHES TILL HERE THEN STOPS WORKING
}
}
正如上面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.
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
注意 - 我已经尝试过使用我在这里以及通过谷歌看到的不同建议,但无济于事。有人可以指出我正确的方向吗?
【问题讨论】:
-
您可能需要在重定向到的任何脚本中再次开始调试。通常,
redirect()函数包含exit;语句。 -
嗨,山姆,感谢您的评论。您的建议确实有效,但我希望有一个更强大的解决方案。
标签: php codeigniter netbeans netbeans-7 xdebug