首先,将代码放入主题文件function.php
中
代码:
/**
* 加载时间
* @return bool
*/
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
挂载代码,也可以去post.php
挂载
加载用时:<?php echo timer_stop();?>
<!--加载时间-->
<li class="mate-time"><i class="fontello fontello-spinner"></i> <span class="mate-value"><a>加载用时</a><?php echo timer_stop();?></span></li>
谢谢分享,
大佬,你那个爱奇艺签到会不会提示异地登录?我用了腾讯视频的签到,风险提示异地登录,好像三次会被封
爱奇艺的不会,腾讯视频那个是qq登录的,qq异地登录当然封号