Drupal 获取文章浏览统计


function statistics_get($nid) {

if ($nid > 0) {
// Retrieve an array with both totalcount and daycount.
return db_query('SELECT totalcount, daycount, timestamp FROM {node_counter}
WHERE nid = :nid', array(':nid' => $nid), array('target' => 'slave'))->fetchAssoc();
}
}

参数 $nid: 文章id

返回值

数组,包含:totalcount(浏览总数量)daycount(今日浏览数)timestamp(最后一次浏览时间戳)

标签: