编程语言
首页 > 编程语言> > php 小时前 分钟前

php 小时前 分钟前

作者:互联网

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 "刚刚";
}
}

标签:now,return,intval,prc,分钟,time,date,小时,php
来源: https://www.cnblogs.com/ForAll-I-Care/p/13159945.html