计算页面执行时间

字体大小: 中小 标准 ->行高大小: 标准

在PHP网页的开头加入以下

<?

$time_start = getmicrotime();

function getmicrotime()

{

list($usec, $sec) = explode(" ",microtime());

return ((float)$usec + (float)$sec);

}

?>

然后到最后加入以下代码

<?

$time_end = getmicrotime();

printf ("[页面执行时间: %.2f毫秒]\n\n",($time_end - $time_start)*1000);

?>

此文章由 http://www.ositren.com 收集整理 ,地址为: http://www.ositren.com/htmls/1136.html