MJJ论坛

 找回密码
 注册
查看: 3097|回复: 8

求php 页面执行速度显示代码

[复制链接]
发表于 2010-4-29 19:57:09 | 显示全部楼层 |阅读模式
像dz底部的这种
我需要在一个自己的php页面实现,请教高手怎么做
发表于 2010-4-29 21:07:03 | 显示全部楼层
在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).';
复制代码

评分

参与人数 1威望 +20 收起 理由
咯拉无米 + 20 精品文章

查看全部评分

 楼主| 发表于 2010-4-29 21:11:41 | 显示全部楼层
每次都是在我需要的时候你出现了
发表于 2010-4-29 21:13:55 | 显示全部楼层

回复 3# 的帖子

我刚好睡醒起来吃饭 嘿嘿
发表于 2010-5-3 15:37:56 | 显示全部楼层


[ 本帖最后由 taian 于 2010-5-23 22:38 编辑 ]
发表于 2010-5-3 16:01:47 | 显示全部楼层

回复 5# 的帖子

已经删除了
发表于 2010-5-3 18:30:06 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2010-5-4 14:59:57 | 显示全部楼层
不错!
发表于 2010-5-4 17:45:00 | 显示全部楼层
mark
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|MJJ论坛

Copyright MJJ论坛 © 2022 All Rights Reserved.

快速回复 返回顶部 返回列表