- List item
function formatTime($time)
{
$now_time = time();
$t = $now_time - $time;
$mon = (int)($t / (86400 * 30));
if ($mon >= 1) {
return '一个月前';
}
$day = (int)($t / 86400);
if ($day >= 1) {
return $day . '天前';
}
$h = (int)($t / 3600);
if ($h >= 1) {
return $h . '小时前';
}
$min = (int)($t / 60);
if ($min >= 1) {
return $min . '分钟前';
}
return '刚刚';
}