Skip to content

Instantly share code, notes, and snippets.

@binjoo
Created October 21, 2012 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binjoo/3926379 to your computer and use it in GitHub Desktop.
Save binjoo/3926379 to your computer and use it in GitHub Desktop.
PHP:TYPECHO:获得访客最近评论数
//获得访客最近评论数
function get_author_comments_num($email = "") {
if(empty($email)) return;
$commentsNum = Helper::options()->commentsNum;
$time = time() - (24 * 60 * 60 * $commentsNum); //当前时间戳减去30天的时间戳
$db = Typecho_Db::get();
$sql = $db->select('COUNT(mail) as emailnum')->from('table.comments')
->where('status = ?','approved')
->where('mail = ?',$email)
->where('created > ?',$time);
$result = $db->fetchAll($sql);
echo $result[0]['emailnum'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment