在php文件头插入这个- $runtime= new runtime;$runtime->start();class runtime{var $StartTime = 0;var $StopTime = 0;function get_microtime(){list($usec,$sec)=explode(' ',microtime());return((float)$usec+(float)$sec);}function start(){$this->StartTime=$this->get_microtime();}function stop(){$this->StopTime=$this->get_microtime();}function spent(){return round(($this->StopTime-$this->StartTime),6);}}
复制代码 然后在要显示的地方插入- $runtime->stop();
- echo 'Processed in ',$runtime->spent(),' second(s).';
复制代码 |