很简单,在需要显示的位置对应的模板部分加上如下代码:
日志数量:<?php echo $sta_cache['lognum'];?>
评论数量:<?php echo $sta_cache['comnum_all'];?>
碎语数量:<?php echo $sta_cache['twnum'];?>
建站日期:2012-11-25
运行时间:<?php echo floor((time()-strtotime("2012-12-05"))/86400); ?>
李明选择在侧边栏显示站点统计,把以下代码添加到模板文件(side.php)对应位置可以了。(请看效果)
<div style="border: 1px solid #BBD7E6;padding:5px;margin:10px 0px 10px 0px;background-color:#F7F4ED;" align="left">
<li>日志数量:<?php echo $sta_cache['lognum'];?></li>
<li>评论数量:<?php echo $sta_cache['comnum_all'];?></li>
<li>碎语数量:<?php echo $sta_cache['twnum'];?></li>
<li>建站日期:2012-11-25</li>
<li>运行时间:<?php echo floor((time()-strtotime("2012-12-05"))/86400); ?></li>
</div>
这是全站显示的,只在首页显示就要加上以下首页判断代码:
<?php if("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL):?>
//加上你的代码
<?php endif;?>
文章作者:博客之家
文章標題:Emlog博客添加站点统计
文章鏈接:https://www.likinming.com/post-119.html
本站所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議,轉載請註明來自博客之家 !
文章標題:Emlog博客添加站点统计
文章鏈接:https://www.likinming.com/post-119.html
本站所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議,轉載請註明來自博客之家 !

评论列表(17条)
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in /home/ftp/a/apxyuder/content/templates/yilushang_list/side.php on line 45
怎么设置?