首页 > php日期 > 计算页面执行时间

计算页面执行时间

计算页面执行时间,在PHP网页的开头加入以下代码:

<?php
$time_start = getmicrotime();
function getmicrotime() {
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
?>

然后到最后加入以下代码

<?php
$time_end = getmicrotime();
printf("[页面执行时间: %.2f毫秒] ", ($time_end - $time_start) * 1000);
?>


本文地址:http://www.phprm.com/riqi/fs867.html

转载随意,但请附上文章地址:-)

标签:页面 执行时间 计算

相关文章

发表留言