- function microtime_float()
- {
- //用空格分割microtime函数
- $_mtime = explode(" ", microtime());
- //时间戳相加
- return $_mtime[1] + $_mtime[0];
- /*
- * 或者
- list($usec, $sec) = explode(" ", microtime());
- return $usec + $sec;
- *
- * */
- }
- //开始时间
- $time_start = microtime_float();
- // 延时
- usleep(100);
- //结束时间
- $time_end = microtime_float();
- //执行耗时=结束时间-开始时间
- $time = $time_end - $time_start;
- echo $time ;