如何调试PHP脚本?
我知道基本的调试,如使用错误报告。PHPEclipse中的断点调试也非常有用。
在phpStorm或任何其他IDE中调试的最佳方法(就快速和简单而言)是什么?
如何调试PHP脚本?
我知道基本的调试,如使用错误报告。PHPEclipse中的断点调试也非常有用。
在phpStorm或任何其他IDE中调试的最佳方法(就快速和简单而言)是什么?
当前回答
在生产环境中,我使用error_log()将相关数据记录到服务器的错误日志中。
其他回答
在生产环境中,我使用error_log()将相关数据记录到服务器的错误日志中。
1)使用print_r()。在TextMate中,我有一个'pre'的片段,它扩展为:
echo "<pre>";
print_r();
echo "</pre>";
2)我使用Xdebug,但还不能让GUI在我的Mac上正常工作。它至少打印出一个可读的堆栈跟踪版本。
PhpEdit有一个内置调试器,但我通常最终使用echo();和print_r ();老式的方式!!
Komodo IDE works well with xdebug, even for the remore debugging. It needs minimum amount of configuration. All you need is a version of php that Komodo can use locally to step through the code on a breakpoint. If you have the script imported into komodo project, then you can set breakpoints with a mouse-click just how you would set it inside eclipse for debugging a java program. Remote debugging is obviously more tricky to get it to work correctly ( you might have to map the remote url with a php script in your workspace ) than a local debugging setup which is pretty easy to configure if you are on a MAC or a linux desktop.
Nusphere也是一个很好的php调试器 nusphere