利用php的microtime实现
function getcurrenttime () {
list ($msec, $sec) = explode(" ", microtime());
return (float)$msec + (float)$sec;
}
如何使用
$begin = getcurrenttime();
sleep(10);
$end = getcurrenttime();
$spend = $end - $begin;
echo "脚本执行时间为:".$spend."\n";