用php得到页面的执行时间
<? /* 得到一个页面的执行时间,并显示出来。 get_microtime()函数可以保存在公共函数文件中供各个页面调用。 */ function get_microtime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } ?> <? //include('include/function.php');
$time_start = get_microtime(); echo "hello 1"; ?> <? for($i=0;$i<100000;$i++) { echo "$i aa"; }
?>
<? echo "hello 2<br>"; $time_end = get_microtime(); $time = $time_end - $time_start; echo $time; ?> seconds.

|