打开 /include/extend.func.php 在最下面加入个方法
05 | * @param string $ time 时间戳 |
08 | if (!function_exists( 'tranTime' )) |
10 | function tranTime($ time ) |
12 | $rtime = date ( "m-d H:i" ,$ time ); |
13 | $htime = date ( "H:i" ,$ time ); |
14 | $etime = time () - $ time ; |
15 | if ($etime < 1) return '刚刚' ; |
17 | 12 * 30 * 24 * 60 * 60 => ' 年 前' , |
18 | 30 * 24 * 60 * 60 => ' 个 月 前' , |
19 | 7 * 24 * 60 * 60 => ' 周 前' , |
20 | 24 * 60 * 60 => ' 天 前' , |
25 | foreach($interval as $secs => $str) |
|
调用标签写法
首页/列表页
1 | [field:pubdate function = "tranTime(@me)" /] |
|
内容页
{dede:field.pubdate function="tranTime(@me)"/}
如果你的时间格式是 2018-10-10 这种正常时间,那要这样写调用标签
1 | [field:pubdate function = "tranTime(GetMkTime(@me))" /] |
2 | {dede:field.pubdate function = "tranTime(GetMkTime(@me))" /} |
|