/**
* 计算页面的执行时间
*/
//页面开始处
$starttime = getMicTime();
sleep(2);
//页面结束处
$endtime = getMicTime();
highlight_file(__FILE__);
echo "
执行结果:".getTotalTime($starttime,$endtime);
function getMicTime(){
$mtime = explode(' ', microtime());
return $mtime[1] + $mtime[0];
}
function getTotalTime($start,$end){
return number_format($end-$start,6);
}
?>
执行结果:1.999655