以新闻news模块为例


全部访问总量

<?php
$ci->db->select_sum('hits');
$query = $ci->db->get(SITE_ID.'_news_hits');
$row = $query->row_array();
echo $row['hits'];
?>

今日访问总量

<?php
$ci->db->select_sum('day_hits');
$query = $ci->db->get(SITE_ID.'_news_hits');
$row = $query->row_array();
echo $row['day_hits'];
?>

本周访问总量

<?php
$ci->db->select_sum('week_hits');
$query = $ci->db->get(SITE_ID.'_news_hits');
$row = $query->row_array();
echo $row['week_hits'];
?>


以上查询不缓存,会降低网站运行效率

文档最后更新时间:2017-07-11 08:09:41