給你的typecho加上加載時間,
百度能搜索到的基本都用不了放到主題里什么都不輸出這個是我從別的主題里面提取出來的代碼記錄一下。
- 原文來源:仙島驛站
在主題?functions.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;
}
然后在主題foot.php
文件需要放加載時間的地方添加加載耗時:<?php echo timer_stop();?>
即可
效果示例:

十分感謝分享,用上了??!