//计算注册时间
function from_date($regtime){
global $DT_TIME;
$time = $DT_TIME - $regtime;
if($time>31536000){
$year = intval($time/31536000);
$t = $time%1314000;
if($t>259200){
$month = intval($t/259200);
$x = $t%259200;
if($x){
$month += 1;
}
return $year.'年'.$month.'个月';
}else{
return $year.'年1个月';
}
}else{
if($time>259200){
$month = intval($time/259200);
$t = $time%259200;
if($t>86400){
$day = intval($t/86400);
}else{
$day = 1;
}
return $month.'个月'.$day.'天';
}else{
if($time>86400){
$day = intval($t/86400);
}else{
$day = 1;
}
return $day.'天';
}
}
$time = $DT_TIME - $regtime;
if($time>31536000){
$year = intval($time/31536000);
$t = $time%1314000;
if($t>259200){
$month = intval($t/259200);
$x = $t%259200;
if($x){
$month += 1;
}
return $year.'年'.$month.'个月';
}else{
return $year.'年1个月';
}
}else{
if($time>259200){
$month = intval($time/259200);
$t = $time%259200;
if($t>86400){
$day = intval($t/86400);
}else{
$day = 1;
}
return $month.'个月'.$day.'天';
}else{
if($time>86400){
$day = intval($t/86400);
}else{
$day = 1;
}
return $day.'天';
}
}
}
列表页使用 {from_date($t[regtime])} 调用即可