首页 > 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/develop/5005fa106b0d5da34c5a57beadcc25c7.html

随意转载^^但请附上教程地址。

标签:none

发表留言