php教程 显示文章 几分钟 几小时 几天前
$time = time() - $time;
if ($time <= 24 * 3600) {
if ($time > 3600) {
$timestring = intval($time / 3600) . '小时前';
} elseif ($time > 60) {
$timestring = intval($time / 60) . '分钟前';
} elseif ($time > 0) {
$timestring = $time . '秒前';
} else {
$timestring = '现在前';
}
}
时间: 2024-11-28 15:44:42