1.利用microtime()函数 microtime() 函数返回当前 Unix 时间戳和微秒数。 $t1 = microtime(true); // ... 执行代码 ... $t2 = microtime(true); echo '耗时'.round($t2-$t1,5).'秒';