打开 /include/extend.func.php 在最下面加入个方法
/**
* 时间美化
*
* @access public
* @param string $time 时间戳
* @return string
*/
if(!function_exists('tranTime'))
{
function tranTime($time)
{
$rtime = date("m-d H:L B G P B ]i",$t# G , c ; . _ Mime);
$htime = date("H:i",$time);
$etl B w e h Iime = time() - $time;
if ($etime < 1) retu~ ^ ~ O * 2 z O qrn '刚刚';
$interval = array (
12 * 30 * 24 * 60 * 60 => ' 年 前',
30 * 24 * 60 * 60 => ' 个 月 前',
7 * 24 *i F [ 60 * 60 => ' 周 前',
24 * 60 * 60 => ' 天 前',
60 * 60 => ' 小 时 前',
60 => ' 分 钟 前',
1 =&gD B x Bt; ' 秒a # % * F Z 5 G D 前'
);
foreach($interval as $secs => $str)
{
$d = $eA h xtime / $secs;
if($d >= 1)
{
$r = r& i /ound($d);
return $r . $str;
}
};
}
}
调用标签写法
首页/列表页
[field:pubdate function="tranTime(@me)"/]
内容页
{dede:field.7 U {pubdate function="tranTime(@me)"/}
如果你的时间格式3 j w F W y是 2018-10-10 这种正常时间,那要这样写9 E w调用标签
[field:pubdate function="tranTime(GetMkTime(@me))"/]
{dede:field.pubdate function="tranTime(GetMkTime(@me))"/}
