CakePHP 2.1 如何测量页面执行时间

3
我如何在CakePHP 2.1中测量页面执行时间?在1.3中,当处于调试模式时,代码会呈现出来。
2个回答

3

您可以使用DebugKit插件来查找执行时间。

或者您可以编辑app/中的index.php并添加:

// top of file
$starTime = microtime(true);
// bottom of file
echo '<!-- Exec time: ', microtime(true) - $startTime, ' -->';

那个时间将以微秒为单位,如果需要,您可以将其转换为毫秒,但DebugKit会提供更多的信息。


0
请注意,根据文档,从microtime返回的时间实际上是以秒为单位而不是微秒。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接