好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 網站建設 > 建站知識 > dede當天或24小時內發表文章日期顯示紅色

dede當天或24小時內發表文章日期顯示紅色

POST TIME:2020-04-10 17:12

真正的“當天”顯示紅色,實現代碼:
[field:pubdate runphp='yes'] if(date("Y-m-d",@me)==date("Y-m-d")){ @me='<font color="#FF0000">'.GetDateTimeMK(@me).'</font>'; } else{ @me=GetDateTimeMK(@me); } [/field:pubdate] 在上面的代碼中,我們使用了dedecms的標準時間函數(GetDateTimeMK(@me)),顯示出來的時間是格式:2010-10-17 21:40:36,如果您想要其它格式,例如:年月日,那么實現代碼如下:
[field:pubdate runphp='yes'] if(date("Y-m-d",@me)==date("Y-m-d")){ @me='<font color="#FF0000">'.MyDate('Y-m-d',@me).'</font>'; }else{ @me=MyDate('Y-m-d',@me); } [/field:pubdate]
再來看下24小時內發表的文章,顯示紅色的代碼,我們直接用 pubdate - time() 做減法后判斷情況輸出結果。
代碼如下:
[field:pubdate runphp='yes'] $nowTime = time(); if($nowTime - (3600 * 24) < @me){ @me='<font color="#FF0000">'.GetDateTimeMK(@me).'</font>'; }else{ @me=GetDateTimeMK(@me); } [/field:pubdate] 時間格式與當天的修改方法是一樣的。不再贅述。(完)


收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266