精華 帝國PHP系統(tǒng)CMS用靈動(dòng)標(biāo)簽調(diào)用昨天、今天、昨天、前天以前的文章
昨天發(fā)布的10篇文章
<?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 * from [!db.pre!]ecms_news where newstime BETWEEN $beginYesterday and $endYesterday order by newstime desc limit 10",0,24,0}]
<?=$bqno?>、<a href="http://www.viagraonlinego.com/<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a><?=date('Y-m-d',$bqr[newstime])?> <br>
[/e:loop]
調(diào)用2024-05-10的10篇文章
[e:loop={'news',10,18,0,'newstime>='.to_time('2024-05-10 00:00:01').' and newstime<='.to_time('2024-05-10 23:59:59')}]
<a href="http://www.viagraonlinego.com/<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a><br>
[/e:loop]
調(diào)用除今天以前的10篇文章
[e:loop={0,10,3,0,'newstime<'.to_time(date("Y-m-d")).''}]
<?=$bqno?>、<a href="http://www.viagraonlinego.com/<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a><?=date('Y-m-d',$bqr[newstime])?> <br>
[/e:loop]
調(diào)用2024-08-01以前的10篇文章
[e:loop={0,10,3,0,'newstime<'.to_time("2024-08-01").''}]
<?=$bqno?>、<a href="http://www.viagraonlinego.com/<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a><?=date('Y-m-d',$bqr[newstime])?> <br>
[/e:loop]
調(diào)用2024-08-01以后的10篇文章(含2024-08-01)
[e:loop={0,10,3,0,'newstime>'.to_time("2024-08-01").''}]
<?=$bqno?>、<a href="http://www.viagraonlinego.com/<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a><?=date('Y-m-d',$bqr[newstime])?> <br>
[/e:loop]
注釋:
//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'))