//返回友好的时间提示
function format_date($date,$isShowDate=true) {
$todaytime = strtotime(date('Y-m-d'));
$limit = time() - $date;
if($date > $todaytime){
if($limit < 60){
return $limit . '秒前';
}elseif($limit >= 60 && $limit < 3600){
return floor($limit/60) . '分钟前';
}else{
return floor($limit/3600) . '小时前';
}
}else{
if(($todaytime - $date) <= 86400){
return '昨天' . date('H:i',$date);
}
if(($todaytime - $date) <= 172800){
return '前天' . date('H:i',$date);
}
if(($todaytime - $date) <= 259200){
return '三天前' . date('H:i',$date);
}else{
return date('Y-m-d',$date);
}
}
}

声明:此文系舞林cuznwww.wulinlw.org)原创稿件,转载请保留版权

et_highlighter