计算php脚本执行时间

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了计算php脚本执行时间相关的知识,希望对你有一定的参考价值。

<?php
    $stime=microtime(true); #获取程序开始执行的时间

    #你写的php代码

    $etime=microtime(true); #获取程序执行结束的时间
    $total=$etime-$stime;   #计算差值
    echo "<br />{$total} times";
?>

  

以上是关于计算php脚本执行时间的主要内容,如果未能解决你的问题,请参考以下文章