织梦DEDE模板实现某小时前,某天前发布的时间标签代码
/*
*AB模板网
*文章发布多少时间前
0I.*/
0IIfunctiontranTime($time){
0III$rtime=date("m-dH:i",$time);
更多精彩就在: 51免费论文网|www.jxszl.com
r/>0IV$htime=date("H:i",$time);
0V$time=time()-$time;
0VIif($time
0VIII}
0IXelseif($time
I.I.$str=$min.分钟前;
I.II}
I.IIIelseif($time
I.V$str=$h.小时前;
I.VI}
I.VIIelseif($time
I.IXif($d==I.)
II0$str=昨天;
III.else
IIII$str=前天;
IIIII}
IIIVelse{
IIV$str=$rtime;
IIVI}
IIVIIreturn$str;
IIVIII}
II.列表页调用标签如下:
[field:pubdatefunction="tranTime(@me)"/]
III.文章页调用标签如下:
{dede:field.pubdatefunction="tranTime(@me)"/}
原文链接:http://www.jxszl.com/biancheng/dedecms/75796.html
热门阅读