mlczhg 发表于 2017-4-4 08:57:11

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);
?>
页: [1]
查看完整版本: php 得到页面执行的时间(毫秒级)