Mch*_*chl 35
调用microtime(true)函数以毫秒分辨率获取当前时间.
<?php
$startTime = microtime(true);
/*stuff is going on*/
echo "Elapsed time is: ". (microtime(true) - $startTime) ." seconds";
Run Code Online (Sandbox Code Playgroud)
microtime — 以微秒为单位返回当前的 Unix 时间戳
<?php
$time = microtime(TRUE);
//...code here...
print (microtime(TRUE)-$time). ' seconds';
Run Code Online (Sandbox Code Playgroud)