在include/extend.func.php页面最下面增加如下代码:


/*


*云梦下载网


*文章发布多少时间前

01 */
02 function tranTime($time) {
03     $rtime = date("m-d H:i",$time);
04     $htime = date("H:i",$time);
05     $time time() - $time;
06     if ($time < 60) {
07         $str = '刚刚';
08     }
09     elseif ($time < 60 * 60) {
10         $min = floor($time/60);
11         $str = $min.' 分钟前';
12     }
13     elseif ($time < 60 * 60 * 24) {
14         $h = floor($time/(60*60));
15         $str = $h.' 小时前 ';
16     }
17     elseif ($time < 60 * 60 * 24 * 3) {
18         $d = floor($time/(60*60*24));
19         if($d==1)
20            $str = '昨天 ';
21         else
22            $str = '前天 ';
23     }
24     else {
25         $str = $rtime;
26     }
27     return $str;
28 }



2.列表页调用标签如下:


[field:pubdate function=”tranTime(@me)” /]


 


3.文章页调用标签如下:


{dede:field.pubdate function=”tranTime(@me)” /}