Typecho 添加当前页面加载时间

在functions.php添加:

function timer_start() {

global $timestart;

$mtime = explode( ‘ ‘, microtime() );

$timestart = $mtime[1] + $mtime[0];

return true;

}

timer_start();

function timer_stop( $display = 0, $precision = 3 ) {

global $timestart, $timeend;

$mtime = explode( ‘ ‘, microtime() );

$timeend = $mtime[1] + $mtime[0];

$timetotal = number_format( $timeend – $timestart, $precision );

$r = $timetotal < 1 ? $timetotal * 1000 . ” ms” : $timetotal . ” s”;

if ( $display ) {

echo $r;

}

return $r;

}

在footer.php底部合适的位置添加:

<?php echo timer_stop();?>

免责声明  

⚠️ 本站的资源均来自于网络或用户网盘投稿,仅作个人学习使用,其版权均归原作者所有。
⚠️ 我们非常重视版权问题,如有侵权请发邮件至mqd#live.com,我们会第一时间处理,敬请谅解!

给TA打赏
共{{data.count}}人
人已打赏
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索