计算页面执行时间

2004年05月18日19:58 查看...次 作者:  【

在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);

?>

责任编辑:admin

给文章打个分先...

平均分:0.6(9 次)

-5 -4 -3 -2 -1 0 1 2 3 4 5

发表我的见解...

  • 您的大名: 留空为匿名
  • 您的主页:
  • 您的邮箱: