本文教程是博主根据handsome模板整理出来的。代码是所有网站都可以用的,引用代码和挂载点请根据您自己的网站修改!
本来想写点开头,无奈文笔不好(语文从来都是弱项,小声bb)。总而言之,就是小绿又闲的没事瞎整,搞了点心玩应,感觉挺有意思(虽然左右不大,可以装逼,万物皆可装逼ヾ(≧∇≦*)ゝ),于是把教程发出来啦。
在这之前,我先放一个预览图!
看出来有啥不一样了吗?
就是上面那个加载用时...
嗯,没啥作用,不过我还是决定写出来教程,大佬可以跳过了,想试试萌新们可以继续往下看了。
不废话了,放代码!
计时代码
/**
* 加载时间
* @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;
}
然后是挂载代码
<!--加载时间-->
<li class="mate-time"><i class="fontello fontello-spinner"></i> <span class="mate-value"><a>加载用时</a><?php echo timer_stop();?></span></li>
首先打开handsome模板文件,找到functions.php
,然后放入计时代码。接着去post.php
文件中大概31行到45行的位置找到位置并插入即可。
5 comments
你这评论表情怎么添加的?
表情是模板自带的呢
额,好吧。
不是这个模板还不能用?
不能用什么?