Home >Backend Development >PHP Tutorial >How to get page execution time in PHP
Some loop code, sometimes you want to know the execution time of the page, you can add the following lines of code to the head and tail of the page:
Head:
<?php $stime=microtime(true);
Tail:
$etime=microtime(true);//获取程序执行结束的时间 $total=$etime-$stime; //计算差值 ?>
Final output:
echo "<br />当前页面执行时间为:{$total} 秒";