按照小时显示更新数量用sql调用6小时:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-6*3600")?>12小时:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-12*3600")?>24小时:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600")?>一个星期:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-86400*7")?>一个月:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-86400*30")?>灵动标签调用6小时:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-6*3600',0,24,0}]<?=$bqr[total]?>[/e:loop]12小时:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-12*3600',0,24,0}]<?=$bqr[total]?>[/e:loop]24小时:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600',0,24,0}]<?=$bqr[total]?>[/e:loop]一个星期:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-86400*7',0,24,0}]<?=$bqr[total]?>[/e:loop]一个月:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-86400*30',0,24,0}]<?=$bqr[total]?>[/e:loop]12*3600即12小时86400*7即7天----------------------------------------------------------------------------------统计昨天发表的文章数量<?php$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;?>[e:loop={"select count(*) as total from [!db.pre!]ecms_news where newstime BETWEEN $beginYesterday and $endYesterday",1,24,0}]<?=$bqr[total]?>[/e:loop] 篇 </li>----------------------------------------------------------------------------------当前栏目本周更新:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_news where classid='$GLOBALS[navclassid]' and newstime >UNIX_TIMESTAMP()-86400*7")?>注释:按栏目统计一周发布文章数 加 classid='栏目id' 按当前栏目一周发布文章数 加 classid='$GLOBALS[navclassid]'//php获取今日开始时间戳和结束时间戳$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));$endToday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;//php获取昨日起始时间戳和结束时间戳 (即:前一天)$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;//调取这两天(包括今天):(修改昨天)--date('d')-1:这两天 、date('d')-2:这三天、以此类推(注意:$beginYesterday、$endYesterday这两个未改动,还是沿用的昨天的名称)$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));$endYesterday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;//调取前两天(修改昨天)--date('d')-2:前两天 、date('d')-3:前三天、以此类推(注意:$beginYesterday、$endYesterday这两个未改动,还是沿用的昨天的名称)$beginYesterday=mktime(0,0,0,date('m'),date('d')-2,date('Y'));$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;//php获取上周起始时间戳和结束时间戳$beginLastweek=mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y'));$endLastweek=mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y'));//php获取本周起始时间戳和结束时间戳$beginThisweek=mktime(0,0 ,0,date("m"),date("d")-date("w")+1,date("Y"));$endThisweek=mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"));//php获取上月起始时间戳和结束时间戳$beginLastmonth=mktime(0,0,0,date("m")-1,1,date("Y"))$endLastmonth=mktime(23,59,59,date("m"),0,date("Y"))//php获取本月起始时间戳和结束时间戳$beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));$endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'))
本文帝国CMS按小时发布文章数的统计(详细说明)到此结束。成熟是一种明亮而不刺眼的光辉,一种圆润而不腻耳的音响,一种不需要对别人察颜观色的从容,一种终于停止了向周围申诉求告的大气,一种不理会哄闹的微笑,一种洗刷了偏激的淡漠,一种无须声张的厚实,一种并不陡峭的高度。小编再次感谢大家对我们的支持!