Wordpress显示运行时间

图片[1]-Wordpress显示运行时间

以网站底部显示我们需要找到footer.php 文件在网站主题目录里面,打开footer.php把下面代码添加进去添加到最后就好了保存

BirthDay = new Date("2002-01-01"); 这里的日期填你的建站日期就行了

本网站已运行:<span id="run_time" style="color: black;"></span>
<script>
function runTime() {
    var d = new Date(), str = ''; 
    BirthDay = new Date("2002-01-01");
    today = new Date();
    timeold = (today.getTime() - BirthDay.getTime());
    sectimeold = timeold / 1000
    secondsold = Math.floor(sectimeold);
    msPerDay = 24 * 60 * 60 * 1000
    msPerYear = 365 * 24 * 60 * 60 * 1000
    e_daysold = timeold / msPerDay
    e_yearsold = timeold / msPerYear
    daysold = Math.floor(e_daysold);
    yearsold = Math.floor(e_yearsold);
    //str = yearsold + "年";
    str += daysold + "天";
    str += d.getHours() + '时';
    str += d.getMinutes() + '分';
    str += d.getSeconds() + '秒';
    return str;
}
setInterval(function () {
    $('#run_time').html(runTime())
}, 1000);
</script>
<?php printf(' | 耗时 %.3f 秒 | 查询 %d 次 | 内存 %.2f MB',timer_stop( 0, 3 ),get_num_queries(),memory_get_peak_usage() / 1024 / 1024);?>
<style>
#momk{animation:change 10s infinite;font-weight:800; }<br />@keyframes change{0%{color:#5cb85c;}25%{color:#556bd8;}50%{color:#e40707;}75%{color:#66e616;}100% {color:#67bd31;}}<br /></style>
© 版权声明
THE END
喜欢就支持一下吧
点赞91 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容