您好(hǎo),歡迎來(lái)到(dào)溫江區帝啓網絡工作室官方網站(zhàn)!ZJJCLΩ< .CN
新聞動态
您現(xiàn)在的(de)位置:首頁 > 技(jì)術(shù)文(wén)摘
帝國(guó)CMS按小(xiǎo)時(shí)發布文(wén)章(δ€zhāng)數(shù)的(de)統計(λ​↓₩jì)(詳細說(shuō)明(míng))
來(lái)源:創立工(gōng)作(zuò)室 作(zuò≥÷)者:馮軍 發布時(shí)間(jiān):2021-04-12 16:07:11 閱↔×₹讀(dú) 2435 次

按照(zhào)小(xiǎo)時(shí)顯示更新數(shù)£±量

用(yòng)sql調用(yòng)
6小(xiǎo)時(shí):<?=$empire->gettotal("selecγ☆t count(*) as total from €♣↔α{$dbtbpre}ecms_表 where newstime>×§UNIX_TIMESTAMP()-6*3600")?>
12小(xiǎo)時(shí):<?=$empire->geδ☆ttotal("select count(*) as to₽λ tal from {$dbtbpre}ecms_表 wher↑®©e newstime>UNIX_T✘®→IMESTAMP()-12*3600")?>
24小(xiǎo)時(shí):<?=$≠™₹φempire->gettotal("select count(*) '<↓♦as total from {$dbtbpre}ecφ →≤ms_表 where newstime>UNIX_TIMESTAMP≥¥∞←()-24*3600")?>
一(yī)個(gè)星期:<?=$empire->Ω↑;gettotal("select count(*) as✘φ$ total from {$dbtbpre}ecms_表 where new←→≥stime>UNIX_TIMESTAMP()-86400*7"→β¶↔)?>
一(yī)個(gè)月(yuè):<?=$empire-& φgt;gettotal("select count(*) as total from ∞★‌{$dbtbpre}ecms_表 where newstime>UNIX_TIM✘×>ESTAMP()-86400*30")?>

靈動标簽調用(yòng)
6小(xiǎo)時(shí):[e:loop={₹δ¶☆'select count(*) as total←♦ from [!db.pre!]ecms_表 where newstime>UNIX_TIMσ☆ESTAMP()-6*3600',0,24,0}]<?=$bqr[to☆ ♠tal]?>[/e:loop]
12小(xiǎo)時(shí):[e:loop={'select count≤​¥☆(*) as total from [!​α•≈db.pre!]ecms_表 where newstime>UNIX_TIMESTAM×♠P()-12*3600',0,24,0}]<?=$bqr[total]?>€≠™<[/e:loop]
24小(xiǎo)時(shí):[e:loop={'select count(*) a≠©₹s total from [!db.pre!]e♣ ©αcms_表 where newstime>​™₽;UNIX_TIMESTAMP()-24*3600'¥♣✘σ,0,24,0}]<?=$bqr[total]?>[/e↔÷:loop]
一(yī)個(gè)星期:[e:loop={'select count(*)Ω÷ as total from [!db.pre!]ecms_表 where newst∑βΩime>UNIX_TIMESTAMP()-86400*7',0,24,0}]<?↑↕‍δ=$bqr[total]?>[/e:loop]
一(yī)個(gè)月(yuè):[e:loop={'selec"©t count(*) as total from [!db.pre!]ecms_≈®∏表 where newstime>UNIX_TIMESTAMP()-86400*¥♥30',0,24,0}]<?=$bqr[total]?>[/e:loop]


12*3600即12小(xiǎo)時(shí)
86400*7即7天
-----------------------------------------------₹♣₹-----------------------------------
統計(jì)昨天發表的(de)文(wén)章(zhāng)數(shù)量
<?php
$beginYesterday=mktime(0,0,0,date('m'),date(​≥₩'d')-1,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),da§★'&te('d'),date('Y'))-1;
?>
[e:loop={"select count(*) as total from [!db.pre!≈δ✔&]ecms_news where newstime BETWEEN $δ♣beginYesterday and $endYesterday",1,2β ★4,0}]<?=$bqr[total]?>[/e:loop] 篇 <λ‍≥/li>

------------------------♣α$----------------------- 'σ----------------------------∞÷±×-------

當前欄目本周更新:
<?=$empire->gettotal("select count(*) as∏λ total from {$dbtbpre}ecms_ne♦∞±εws where classid='$GLOBALS[nav‌γ'classid]' and newstime≥∞"∞  >UNIX_TIMESTAMP()-86400*7")?>

注釋:按欄目統計(jì)一(yī)周發布文(w↕™én)章(zhāng)數(shù) 加 classid='•ε÷欄目id' 
      按當前欄目一(yī)周發布文(wén)章(zhāng₹≥)數(shù) 加 classid='$GLOBALS[navclassid]'®&α 

//php獲取今日(rì)開(kāi)始時(shí)間(jiān)戳和(hé)結Ωα≥束時(shí)間(jiān)戳
$beginToday=mktime(0,0,0,date('m'),date('d→★★'),date('Y'));
$endToday=mktime(0,0,0,da✔∏©¶te('m'),date('d')+1,date('Y'))-1;

//php獲取昨日(rì)起始時(shí)間(jiān)戳和(h↓$<é)結束時(shí)間(jiān)戳 (即:前一(yī)天)
$beginYesterday=mktime(0,0,≥₩÷0,date('m'),date('d')-1,date('Y')¥λ );
$endYesterday=mktime(0,0←εσβ,0,date('m'),date('d'),d₽€φate('Y'))-1;

//調取這(zhè)兩天(包括今天):(修改昨天)--date('d')-1:‍♠這(zhè)兩天 、date('d')-2:這(zhè)三天、₩<以此類推(注意:$beginYesterday、$end ​• Yesterday這(zhè)兩個(gè)÷₹未改動,還(hái)是(shì)沿用(yòng)的(ε¥₽de)昨天的(de)名稱)
$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:前三天、以此類推(注意:$beginY↓♦©esterday、$endYesterda×→y這(zhè)兩個(gè)未改動,還(hái)是(shì)§₹≤↔沿用(yòng)的(de)昨天的(de)名稱)
$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àng)周起始時(shí)間(jiān)戳和(h∞&♥¥é)結束時(shí)間(jiān)戳 
$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ān)戳和(hé)結束時(shí)間(ji​↔ān)戳 
$beginThisweek=mktim↕®✔Ωe(0,0 ,0,date("m"),date("d")-date("w")+1,d☆Ωate("Y"));
$endThisweek=mktime(23,59,59,date("m"),date☆±&("d")-date("w")+7,date("Y"));

//php獲取上(shàng)月(yuè)起始時(shí)間(jiān)戳和(héδ™≠∑)結束時(shí)間(jiān)戳 
$beginLastmonth=mktime€₩♦(0,0,0,date("m")-1,1,date("Y₹γ✔↑"))
$endLastmonth=mktime(23,59,59,da→≥≠te("m"),0,date("Y"))

//php獲取本月(yuè)起始時(shí)間 •(jiān)戳和(hé)結束時(shí)間γ←(jiān)戳 
$beginThismonth=mktime(0,0,0,dat★↑∞e('m'),1,date('Y'));
$endThismonth=mktime(23,59,59,date('m'),date('t'€≥),date('Y'))