zoukankan
html css js c++ java
php计算页面执行时间
<?
class
timer
{
var
$StartTime
=
0
;
var
$StopTime
=
0
;
var
$TimeSpent
=
0
;
function
start(){
$this
->
StartTime
=
microtime
();}
function
stop(){
$this
->
StopTime
=
microtime
();}
function
spent(){
if
(
$this
->
TimeSpent) {
return
$this
->
TimeSpent;
}
else
{
$StartMicro
=
substr
(
$this
->
StartTime
,
0
,
10
);
$StartSecond
=
substr
(
$this
->
StartTime
,
11
,
10
);
$StopMicro
=
substr
(
$this
->
StopTime
,
0
,
10
);
$StopSecond
=
substr
(
$this
->
StopTime
,
11
,
10
);
$start
=
doubleval
(
$StartMicro
)
+
$StartSecond
;
$stop
=
doubleval
(
$StopMicro
)
+
$StopSecond
;
$this
->
TimeSpent
=
$stop
-
$start
;
return
substr
(
$this
->
TimeSpent
,
0
,
8
)
.
"
秒
"
;
}
}
//
end function spent();
}
//
end class timer;
//例子
$timer
=
new
timer;
$timer
->
start();
/*
你的代码放在此处
*/
$timer
->
stop();
echo
"
执行本SCRIPT共
"
.
$timer
->
spent();
?>
查看全文
相关阅读:
使用Layui上传图片,并进行压缩(非原创,证实可用)
mysql 存储过程及事件
Redis一些简单的笔记
RIOT 技术笔记-01 RIOT介绍
杂七杂八-ubuntu安装eclipse
杂七杂八-sqlyog连接mysql错误码2058
杂七杂八-Mysql8.0忘记root密码
RIOT学习笔记-01 cygwin安装
Ubutun-安装远程桌面
中间件-RocketMQ 02 Docker下的安装
原文地址:https://www.cnblogs.com/studio313/p/1061299.html
最新文章
python-5
Python-4
Python-3
linux——python
python2
python学习一
小米心得5待续
小米心得
小米心得3
过滤器、拦截器、SpringAop
热门文章
@Autowired 和@Resource区别
JAVA String 的 split方法,当使用特殊字符分隔时
【Git】Windows 配置 SSH-Key
markdownPad在win10下渲染报错问题
Spring-security-oAuth2分享
httpBasic 认证的URL访问
composer安装工具包的时候卡住不动了怎么办
记录一次mysql线上误清空表的一个操作
解决使用Nginx错误 Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING问题
mysql-bin 开启的时候不记录问题,跟配置文件有关
Copyright © 2011-2022 走看看