function getTimetoNow($time){
$now=time();
$n=$now-$time;
$t=0;
if($n<60){
return $n.'秒前';
}
elseif($n>=60&&$n<3600){
$t=floor($n/60);
return $t.'分钟前';
}
elseif($n>=3600&&$n<86400){
$t=floor($n/3600);
return $t.'小时前';
}
elseif($n>=86400&&$n<604800){
$t=floor($n/86400);
return $t.'天前';
}
elseif($n>=604800&&$n<2678400){
$t=floor($n/604800);
return $t.'周前';
}
elseif($n>=2678400&&$n<31536000){
$t=floor($n/2678400);
return $t.'月前';
}
else{
return '很久以前';
}
}SyntaxHighlighter.highlight();