3

如何在 CakePHP 2.1 中测量页面执行时间?在 1.3 中,它在调试模式下呈现在代码中。

4

2 回答 2

3

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

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

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

该时间将以微秒为单位,因此您可以根据需要将其转换为 ms,但 DebugKit 为您提供了更多信息。

于 2012-05-06T06:30:09.497 回答
0

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

于 2013-11-11T05:03:26.320 回答