phpcms教程之增加统计代码可以统计每天发表文章数量
代码如下:
<?php
defined('IN_PHPCMS') or exit('No permission resources.');</p> <p>class tongji{
function __construct(){
$this->db = pc_base::load_model("news_model");
}</p> <p> function postnum(){
$end = $_GET['end'] ? strtotime($_GET['end']) : time();
$i = 0;
while($i < 10){
$daystart = strtotime(" -1 day",$end);
$dayend = $end;
$where = "inputtime > $daystart and inputtime < $dayend ";
$number = $this->db->count($where);
echo date("Y-m-d",$daystart)."发表了".$number."<br/>";
$end = $daystart;
$i++;
}</p> <p> }
}
本文由主机测评网发布,不代表主机测评网立场,转载联系作者并注明出处:https://zhuji.jb51.net/phpcms/7076.html