很多网站,论坛啊,底部都有页面加载执行完成所需要的时间,这点可以反映程序性能网速等。其实实现这个功能非常简单.
很多网站,论坛啊,底部都有页面加载执行完成所需要的时间,这点可以反映程序性能网速等。其实实现这个功能非常简单.
下面实例代码:
<?phpfunction microtime_float(){ list($usec,$sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec);//$usec微秒,$sec秒数 两者单位均为秒}$time_start = microtime_float();$time_start1=microtime(true);usleep(100);//delay 100microseconds$time_end = microtime_float();$time_end1=microtime(true);$time = $time_end - $time_start;echo "Did nothing in $time seconds ";echo " 精确点的: $time_end - $time_start=".($time_end - $time_start);echo "[object Object]";echo "不够精确的: $time_end1 - $time_start1=".($time_end1 - $time_start1);?>