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