CakePHP 2.1测量页面执行时间 [英] CakePHP 2.1 Measuring Page Execution Time

查看:100
本文介绍了CakePHP 2.1测量页面执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I Measure the Page Execution Time in CakePHP 2.1? In 1.3 it was rendered in the code when in debug mode.

推荐答案

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

You could use DebugKit Plugin to find out execution time.

或者您可以编辑索引.php in app /并添加:

Or you can edit index.php in app/ and add:

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

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

That time will be in microseconds so you could convert it to ms if you want, but DebugKit gives you a lot more information.

这篇关于CakePHP 2.1测量页面执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆