• 欢迎访问调频海南,代码调频,代码电台,在空中与朋友们分享IT技术,建站知识与经验心得! 好乐虎帮助手册
  • 站长承接网站建设,网站修改等技术服务

帝国cms 多少天 多少日期前发布

CMS问题 chris 2个月前 (01-31) 94次浏览 3个评论

<?php
//—————————用户自定义标签函数文件

function user_time($tm,$num) {
if($num==1){
$tm = strtotime($tm); //将输入的时间时间截化
}
$cur_tm = time(); $dif = $cur_tm-$tm;
$pds = array(‘秒’,’分钟’,’小时’,’天’,’周’,’个月’,’年’);
$lngh = array(1,60,3600,86400,604800,2630880,31570560);
for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v–); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]);
$no = floor($no);
//如果要把格式改成”X分钟 前”的话,请把%d%s改成%d %s
$x=sprintf(“%d%s”,$no,$pds[$v]);
return $x.”前”;
}

?>

把上面代码放到e/class/userfun.php中

然后在列表模板中调用

$listtemp=’后面这个标签是时间调用’.user_time($r[newstime],0).’ 标签结束 ‘;

fm0898.com站长提醒您,如果在内容模板或者是灵动标签中调用方法: <?=user_time($navinfor[newstime],0)?>


调频海南(fm0898.com) , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:帝国cms 多少天 多少日期前发布
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(3)个小伙伴在吐槽
  1. Hi there! This article couldn't be written any better! Going through this post reminds me of my previous roommate! He always kept preaching about this. I most certainly will forward this article to him. Fairly certain he's going to have a very good read. Thanks for sharing!
    higo.vn2020-02-05 21:36 回复
  2. If some one needs to be updated with hottest technologies therefore he must be go to see this web page and be up to date everyday.
  3. When I originally commented I appear to have clicked on the -Notify me when new commments are added- checkbox and from now onn wheneer a comment is added I receive 4 emails with the same comment. Is there an easy method you are able to remofe me from that service? Cheers!