- <?
- $pagestartime=microtime();
- ?>
- <!--网页内容 start-->
- 网页内容
- ...
- ...
- <!--网页内容 end-->
- <?
- $pageendtime = microtime();
- $starttime = explode(" ",$pagestartime);
- $endtime = explode(" ",$pageendtime);
- $totaltime = $endtime[0]-$starttime[0]+$endtime[1]-$starttime[1];
- $timecost = sprintf("%s",$totaltime);
- echo "页面运行时间: $timecost 秒";
- ?>
- //该片段来自于http://www.codesnippet.cn/detail/040520149417.html
来源: http://www.codesnippet.cn/detail/040520149417.html