花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來到素材無憂網(wǎng),按 + 收藏我們
登錄 注冊(cè) 退出 找回密碼

帝國(guó)CMS按小時(shí)發(fā)布文章數(shù)的統(tǒng)計(jì)(詳細(xì)說明)

時(shí)間: 2024-02-25 09:30 閱讀: 作者:素材無憂網(wǎng)

按照小時(shí)顯示更新數(shù)量

用sql調(diào)用
6小時(shí):gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-6*3600")?>
12小時(shí):gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-12*3600")?>
24小時(shí):gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600")?>
一個(gè)星期:gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-86400*7")?>
一個(gè)月:gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-86400*30")?>

靈動(dòng)標(biāo)簽調(diào)用
6小時(shí):[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-6*3600',0,24,0}][/e:loop]
12小時(shí):[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-12*3600',0,24,0}][/e:loop]
24小時(shí):[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600',0,24,0}][/e:loop]
一個(gè)星期:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-86400*7',0,24,0}][/e:loop]
一個(gè)月:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-86400*30',0,24,0}][/e:loop]


12*3600即12小時(shí)
86400*7即7天
----------------------------------------------------------------------------------
統(tǒng)計(jì)昨天發(fā)表的文章數(shù)量
$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}][/e:loop] 篇

----------------------------------------------------------------------------------

當(dāng)前欄目本周更新:
gettotal("select count(*) as total from {$dbtbpre}ecms_news where classid='$GLOBALS[navclassid]' and newstime >UNIX_TIMESTAMP()-86400*7")?>

注釋:按欄目統(tǒng)計(jì)一周發(fā)布文章數(shù) 加 classid='欄目id'
按當(dāng)前欄目一周發(fā)布文章數(shù) 加 classid='$GLOBALS[navclassid]'

//php獲取今日開始時(shí)間戳和結(jié)束時(shí)間戳
$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獲取昨日起始時(shí)間戳和結(jié)束時(shí)間戳 (即:前一天)
$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;

//調(diào)取這兩天(包括今天):(修改昨天)--date('d')-1:這兩天 、date('d')-2:這三天、以此類推(注意:$beginYesterday、$endYesterday這兩個(gè)未改動(dòng),還是沿用的昨天的名稱)
$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;

//調(diào)取前兩天(修改昨天)--date('d')-2:前兩天 、date('d')-3:前三天、以此類推(注意:$beginYesterday、$endYesterday這兩個(gè)未改動(dòng),還是沿用的昨天的名稱)
$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獲取上周起始時(shí)間戳和結(jié)束時(shí)間戳
$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獲取本周起始時(shí)間戳和結(jié)束時(shí)間戳
$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獲取上月起始時(shí)間戳和結(jié)束時(shí)間戳
$beginLastmonth=mktime(0,0,0,date("m")-1,1,date("Y"))
$endLastmonth=mktime(23,59,59,date("m"),0,date("Y"))

//php獲取本月起始時(shí)間戳和結(jié)束時(shí)間戳
$beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));
$endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'))

版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請(qǐng)注明: 帝國(guó)CMS按小時(shí)發(fā)布文章數(shù)的統(tǒng)計(jì)(詳細(xì)說明)

相關(guān)文章
模板推薦