本篇文章是对使用php获取程序执行的时间进行了详细的分析介绍,需要的朋友参考下
在head.htm中加入,也就是在默认模版中添加“$stime=microtime(true); //获取程序开始执行的时间”
代码如下:
<!–<?php
$stime=microtime(true); //获取程序开始执行的时间
$GuideFid[$fid]=str_replace(“>首页”,””,$GuideFid[$fid]);
$fupId=intval($fupId);
$topMenu[$fupId]=’ck’;
print <<<EOT
–>
$stime=microtime(true); //获取程序开始执行的时间
$GuideFid[$fid]=str_replace(“>首页”,””,$GuideFid[$fid]);
$fupId=intval($fupId);
$topMenu[$fupId]=’ck’;
print <<<EOT
–>
这里是网页
再在foot.htm修改如:
代码如下:
<!–
EOT;
$etime=microtime(true);//获取程序执行结束的时间
$total=$etime-$stime; //计算差值
echo “
[页面执行时间:{$total} ]秒”;
?>
EOT;
$etime=microtime(true);//获取程序执行结束的时间
$total=$etime-$stime; //计算差值
echo “
[页面执行时间:{$total} ]秒”;
?>
您可能感兴趣的文章:
- PHP间隔一段时间执行代码的方法
- PHP中使用微秒计算脚本执行时间例子
- php计算当前程序执行时间示例
- php获取目标函数执行时间示例
- 显示程序执行时间php函数代码
- php记录代码执行时间(实现代码来源gaodai$ma#com搞$代*码网)
- php计算函数执行时间的方法
以上就是如何用php获取程序执行的时间的详细内容,更多请关注gaodaima搞代码网其它相关文章!