1、找到include/extend.func.php,在最后面添加
复制代码function conversionTime ($time) {
$today = Floor(time()/(3600 * 24));
$senday= Floor($time/(3600 * 24));
$updays = $today-$senday;
if($updays==0)
$str = '今天';
elseif ($updays >=1 && $updays < 31) {
$str = $updays.'天前 ';
}
elseif ($updays >0 && $updays < 1 ) {
$h = floor($updays * 24);
$str = $h.'小时前 ';
}
elseif ($updays >= 31&& $updays < 365) {
$m = floor($updays / 31);
$str = $m.'月前 ';
}
elseif ($updays >= 31&& $updays < 365) {
$y = floor($updays / (31* 365));
$str = $y.'年前 ';
}
else {
$str = $rtime;
}
return $str;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
2、调用方法
列表页:[field:pubdate function="conversionTime(@me)" /]
内容页:{dede:field.pubdate function="conversionTime(@me)"/}
wordpress如何把发布的具体时间改成(几分/几小时前)类型
上面是“dedecms织梦把发布时间改成多少时间前”的全面内容,想了解更多关于 织梦cms 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1458.html
workflows工作流
一只乌鸦栖息在一盏神灯上
一只沮丧的卡通小丑鱼ComfyUI工作流
一张精心制作的熊岛复古地图ComfyUI工作流
一张科幻照片,火星车在沙漠里ComfyUI工作流
一个美丽的女孩穿着花瓣做的衣服
强大的长袍法师ComfyUI工作流
一只竹节虫ComfyUI工作流
停在音乐节露营地的一辆复古大众巴士由羊毛制成
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!