思路:找到每篇文章的访问量,相加即可
SELECT SUM(VIEWS) FROM `typecho_contents`
function get_all_views(){
$db = Typecho_Db::get();
$row = $db->fetchAll('SELECT SUM(VIEWS) FROM `typecho_contents`');
echo number_format($row[0]['SUM(VIEWS)']);
}
如果不够用,可以在数据库扩展中封装MySQL方法