microtime计算脚本执行时间 [php] view plain copy print ? /** * Description:计算当前时间 * * @return float */ function getCurrentTime () { list ($msec, $sec) = explode(" ", microtime()); return (float)$msec + (float)$sec; } 使用示例 [php] view plain copy print ? $begin = getCurrentTime(); sleep(10); $end = getCurrentTime(); $spend = $end-$begin; echo "脚本执行时间为:".$spend."\n";