计算PHP脚本运行时间的代码
时间:2008-05-29 来源:剑心通明
php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
//例子
//开始
$time_start = getmicrotime(); www~phperz~com
//这里放你的代码
//结束
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds"; //输出运行总时间
?>
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
//例子
//开始
$time_start = getmicrotime(); www~phperz~com
//这里放你的代码
//结束
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds"; //输出运行总时间
?>
相关阅读 更多 +