最新活动:电脑PC端+手机端+微网站+自适应网页多模板选择-建站388元起价!!!
要源码
当前位置:主页 > 网站建设 > 织梦CMS时间格式实现XX秒前、XX分钟前、XX天前织

织梦CMS时间格式实现XX秒前、XX分钟前、XX天前织

时间:2023-05-25 11:05:25 阅读: 文章分类: 网站建设 作者: 网络小编

导读:织梦技巧织梦技巧打开 /include/extend.func.php 在最下面加入个方法 /** * 时间美化 * * @access public * @param str百度seo网站优化seo网站关键词优化。

百度seo网站优化seo网站关键词优化打开 /include/extend.func.php 在最下面加入个方法 /** * 时间美化 * * @access public * @param string $time 时间戳 * @return string */ if (!function_exists( tranTime )){ function tranTime ($time) {$rtime = date( m-d H:i ,$time);$htime = date( H:i ,$time);$etime = time() - $ti […]

打开 /include/extend.func.php 在最下面加入个方法

/** * 时间美化 * * @access public * @param string $time 时间戳 * @return string */ if(!function_exists('tranTime')) { function tranTime($time) { $rtime = date("m-d H:i",$time); $htime 公司网站建设= date("H:i",$time); $etime = time() - $time; if ($etime < 1) return '刚刚'; $interval = array ( 12 * 30 * 24 * 60 * 60 => ' 年 前', 30 * 24 * 60 * 60 => ' 个 月 前', 7 * 24 * 60 * 60 => ' 周 前', 24 * 60 * 60 => ' 天 前', 60 * 60 => ' 小 时 前', 60 => ' 分 钟 前', 1 => ' 秒 前' ); foreach($interval as $secs => $s网站建设教程tr) { $d = $etime / $secs; if($d >= 1) { $r = round($d); return $r . $str; } }; } }

调用标签写法

首页/列表页

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

内容页

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

如果你的时间格式是 2018-10-10 这种正常时间,那要这样写调用标签

[field:pubdate function="tranTime(GetMkT网站建设制作ime(@me))"/] {dede:field.pubdate function="tranTime(GetMkTime(@me))"/}相关百度seo网站优化seo网站关键词优化。

关键词标签: CMS 标签 格式

声明: 本文由我的SEOUC技术文章主页发布于:2023-05-25 ,文章织梦CMS时间格式实现XX秒前、XX分钟前、XX天前织主要讲述标签,格式,CMS网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_8185.html

我的IDC 网站建设技术SEOUC.COM
专注网站建设,SEO优化,小程序设计制作搭建开发定制网站等,数千家网站定制开发案例,网站推广技术服务。
  • 5000+合作客服
  • 8年从业经验
  • 150+覆盖行业
  • 最新热门源码技术文章