/** * 测试运行时间 * * @return int */ public static function debugTime($flag = '', $output = false) { if (!self::$_lastTime) { self::$_lastTime = array_sum(explode(' ', microtime())); } $nowTime = array_sum(explode(' ', microtime())); $time = $nowTime - self::$_lastTime; self::$_lastTime = $nowTime; if ($output) { echo $flag . $time . "\n"; } return $time; }