php 小时前 分钟前

时间:2020-06-18 21:58:32   收藏:0   阅读:59

function getTime($time){
$now = time();
$prc =$now - $time;
if ($prc > 86400){
return date(‘Y-m-d h:s‘,$time);
}elseif ($prc > 3600){
return intval(date(‘h‘,$prc))."小时前";
}elseif ($prc > 60){
return intval(date(‘i‘,$prc))."分钟前";
}else{
return "刚刚";
}
}

原文:https://www.cnblogs.com/ForAll-I-Care/p/13159945.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!