时间: 2020-12-3|tag: 68次围观|0 条评论

<?php
    //定义一个run_time()方法,获取当前的时间的unix时间戳,精确到微秒;
    function run_time(){
        //microtime()函数获取当前的unix时间戳
        list($msec,$sec)=explode(" ",microtime());
        return ((float)$msec+(float)$sec);
    }
    $start_time=run_time();
    echo $start_time;
    $time1=time();
    $time2=strtotime("2018-01-01");
    $cha=ceil(($time2-$time1)/60/60/24);
    echo "距离2018年元旦还有<font color='red'>{$cha}</font>天!!!<br>";
    $end_time=run_time();
    //计算程序运行的时间
    $runtime=$end_time-$start_time;
    echo "倒计时程序运行的时间为:<font color='blue'>".$runtime."</font>s";
?>

原文链接:https://blog.csdn.net/living_ren/article/details/75081962

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《计算程序运行时间的方法
   

还没有人抢沙发呢~