获得页面执行时间<?php <br />
header("Content-type:text/html;charset=utf-8");<br>
class runtime<br>
{<br>
private $begintime = 0;<br>
private $endtime = 0;<br>
private function gettime()<br>
{<br>
list($usec,$sec) = explode(" ", microtime());<br>
return ((float)$usec + (float)$sec);<br>
}<br>
public function begin()<br>
{<br>
$this->begintime = $this->gettime();<br>
}<br>
public function end()<br>
{ <br>
$this->endtime = $this->gettime();<br>
}<br>
public function spent()<br>
{<br>
return round(($this->endtime - $this->begintime) * 1000, 1);<br>
}<br>
}<br>
$runtime = new runtime();<br>
$runtime->begin();<br>
for ($i=0; $i
echo $i;<br>
}<br>
$runtime->end();<br>
echo '页面执行时间'.$runtime->spent().'毫秒';<br>
?>
AD:真正免费,域名+虚机+企业邮箱=0元