Home >php教程 >php手册 >计算页面执行时间

计算页面执行时间

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 09:14:18995browse

页面|执行

计算页面执行时间
在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);

?>



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn