全球主机交流论坛

标题: 求php 页面执行速度显示代码 [打印本页]

作者: 咯拉无米    时间: 2010-4-29 19:57
标题: 求php 页面执行速度显示代码
像dz底部的这种
我需要在一个自己的php页面实现,请教高手怎么做
作者: zyypp    时间: 2010-4-29 21:07
在php文件头插入这个
  1. $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);}}
复制代码
然后在要显示的地方插入
  1. $runtime->stop();
  2. echo 'Processed in ',$runtime->spent(),' second(s).';
复制代码

作者: 咯拉无米    时间: 2010-4-29 21:11
每次都是在我需要的时候你出现了
作者: zyypp    时间: 2010-4-29 21:13
标题: 回复 3# 的帖子
我刚好睡醒起来吃饭 嘿嘿
作者: taian    时间: 2010-5-3 15:37


[ 本帖最后由 taian 于 2010-5-23 22:38 编辑 ]
作者: wzwen    时间: 2010-5-3 16:01
标题: 回复 5# 的帖子
已经删除了
作者: cosence    时间: 2010-5-3 18:30
提示: 作者被禁止或删除 内容自动屏蔽
作者: 微笑着吃饭    时间: 2010-5-4 14:59
不错!
作者: WAKAKA    时间: 2010-5-4 17:45
mark




欢迎光临 全球主机交流论坛 (https://443502.xyz/) Powered by Discuz! X3.4