- $pagestartime=microtime();
- ?>
- 网页内容
- ...
- ...
- $pageendtime = microtime();
- $starttime = explode(" ",$pagestartime);
- $endtime = explode(" ",$pageendtime);
- $totaltime = $endtime[0]-$starttime[0] $endtime[1]-$starttime[1];
- $timecost = sprintf("%s",$totaltime);
- echo "页面运行时间: $timecost 秒";
- ?>
-
- 来源:PHP站中文网
复制代码
|