Heim  >  Artikel  >  Backend-Entwicklung  >  有哪些 PHP 调试技巧?

有哪些 PHP 调试技巧?

WBOY
WBOYOriginal
2016-06-06 16:42:13943Durchsuche

回复内容:

我目前遇到的最让我称赞的debug方式是:xdebug的
<code class="language-php"><span class="x">xdebug_start_trace();</span>
<span class="x">/* 业务代码     */</span>
<span class="x">xdebug_stop_trace();</span>
</code>
1、最简单经典的var_dump()
2、配置error_log,能够解决很多疑难杂症
3、firebug + firephp或者chrome + chromephp php调试指南:heiyeluren-doc.googlecode.com

挺薄的一个册子,讲的不错。 XHProf 吧,
FaceBook开源出来的神器,PHP轻量级调试工具,可在生产环境中使用。

有哪些 PHP 调试技巧? 有哪些 PHP 调试技巧?
1. Inclusive Time :包括子函数所有执行时间。
2. Exclusive Time/Self Time:函数执行本身花费的时间,不包括子树执行时间。
3. Wall Time:花去了的时间或挂钟时间。
4. CPU Time:用户耗的时间+内核耗的时间
5.Inclusive CPU:包括子函数一起所占用的CPU
6.Exclusive CPU:函数自身所占用的CPU 我比较喜欢笨方法print_r + exit来调试代码。 php 5.6 新增 phpdbg,使用方法上类似于gdb。
官方货 .gdb xdebug xdebug 可以结合;ide 进行断点调试
phpstrom+xdebug + chrome(debug helper) or FF (easy xdebug) macgdbp xdebug chromephp
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn