文章来源:原创
一、页面加载时间功能
在主题目录下找到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 . " 毫秒" : $timetotal . " 秒";
    if ( $display ) {
    echo $r;
    }
    return $r;
   }然后在需要显示加载时间的地方,比如说footer.php文件里加入以下代码即可:
<?php echo timer_stop();?>二、Gravatar头像同步
由于众所周知的原因,Gravatar在国内不能正常使用,好在国内许多厂商比如腾讯、七牛等都提供了相应的服务,只要在config.inc.php文件里加下以下代码即可(我用的是七牛源):
/**定义七牛Gravatar头像源 */
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://dn-qiniu-avatar.qbox.me/avatar/');                            
                        
		
		
隔壁小胡
2021年08月13日图片无法加载
Windows 10 · Google Chrome