当前位置:Linux教程 - Php - 页面运行时间代码

页面运行时间代码

页面运行时间代码

方法:
代码:
<?
$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 秒";
?>