您的位置:老铁SEO > 站长新闻 > 网站技术 >

抖音信号用伪原创 dede当天或24小时内发表文章日期显示红色

文章来源:http://www.6cu.com

作者:伪原创软件

人气:20

2021-05-13 17:52:18

真正的“当天”显示红色,实现代码:
[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]

时间格式与当天的修改方法是一样的。不再赘述。(完)

上一篇:爱奇艺伪原创 织梦dede动态调用评论数

下一篇:没有了

相关文章

在线客服

外链咨询

扫码加我微信

微信:juxia_com

返回顶部