PHPCMS v9根据刚刚,1分钟前,1小时前,几天前显示文章日期
把下面实例代码另存为 time.php
在程序根目录的index.php
加入
include PHPCMS_PATH.'/time.php';
在显示时间的位置加入
时间调用代码{formatTime($r[inputtime],1)}另外加两个代码function formatTime($date) {
$str = '';
$timer = strtotime($date);
$diff = $_SERVER['REQUEST_TIME'] - $timer;
$day = floor($diff / 86400);
- 阅读剩余部分 -