您现在的位置: Linux教程 - Php - 计算页面执行时间

计算页面执行时间

添加记录: Linux 类别: Php 发布日期: 2005.06.22

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

<?

$time_start = getmicrotime();

function getmicrotime()

{

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

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

}

?>

然后到最后加入以下代码

<?

$time_end = getmicrotime();

printf ("[页面执行时间: %.2f毫秒]\n\n",($t
Tags: Php