类名:Debug
mark(name) 标记调试位置,静态方法
useTime(start,end,decimals = 6) 调试区间所用的时间,静态方法
useMemory(start,end) 调试区间所用的内存,静态方法
getMemPeak(start,end) 调试区间的内存占用峰值,静态方法
实例:
[php]
$start = 'debug_start';
$end = 'debug_end';
Debug::mark($start);
//处理你的业务逻辑
Debug::mark($end);
printf("Use Time:%sn", Debug::useTime($start,$end));
printf("Use Memory:%sn", Debug::useMemory($start,$end));
[/php]
还有一个简化的方法:
使用下面的方法可以很方便的获取某个区间的运行时间和内存占用情况
//debug_start($label='') //记录调试开始时间
//debug_end($label='') //输出调试范围运行时间(相同label属于一个调试范围)
//例如:
debug_start('run');
$blog = D("Blog");
$blog->select();
debug_end('run');
//会输出下面的运行信息:
Process run: Times 0.007730s Memories 76 k
最后
以上就是冷静老虎最近收集整理的关于thinkphp debug.php,ThinkPHP Debug类及实例的全部内容,更多相关thinkphp内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复