function get_long_time($date){ $curr = time(); $date = strtotime($date); $tmp = $curr - $date; if($tmp < 60){ $re = $tmp.‘秒前‘; }else if($tmp < 3600){ $re = floor($tmp/60).‘分钟前‘; }else if($tmp < 86400){ $re = floor($tmp/3600).‘小时前‘; }else if($tmp < 259200){//3天内 $re = floor($tmp/86400).‘天前‘; }else{ $re = date(‘m月d日‘,$date); } echo $re; }
时间: 2024-10-06 15:39:21