如何调试PHP脚本?
我知道基本的调试,如使用错误报告。PHPEclipse中的断点调试也非常有用。
在phpStorm或任何其他IDE中调试的最佳方法(就快速和简单而言)是什么?
如何调试PHP脚本?
我知道基本的调试,如使用错误报告。PHPEclipse中的断点调试也非常有用。
在phpStorm或任何其他IDE中调试的最佳方法(就快速和简单而言)是什么?
当前回答
通常我发现创建一个自定义日志功能可以保存在文件中,存储调试信息,并最终在公共页脚上重新打印。
您还可以重写常见的Exception类,以便这种类型的调试是半自动化的。
其他回答
Print_r (debug_backtrace());
或者类似的东西:-)
坦率地说,是print和print_r()的组合,以打印出变量。我知道很多人更喜欢使用其他更高级的方法,但我发现这是最容易使用的。
我要说的是,直到我在Uni做了一些微处理器编程,甚至都不会使用它,我才完全理解这一点。
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.
PhpEd真的很好。你可以进入/进入/退出函数。你可以运行特别代码,检查变量,改变变量。太神奇了。
Xdebug和用于notepad++的DBGp插件用于繁重的bug查找,FirePHP用于轻量级的东西。又快又脏?没有什么比dBug更好的了。