代码片段1-时间
$res_time=$end_time-$start_time;switch ($res_time) {case $res_time <= 60 :if ($res_time < 0)$res_time = 3;$res_time .= '秒';break;case $res_time > 60 && $res_time <= 3600 :$res_time = floor ( $res_time / 60 );$res_time .= '分钟';break;case $res_time > 3600 && $res_time <= 3600 * 24 :$res_time = floor ( $res_time / 3600 );$res_time .= '小时';break;case $res_time > 3600 && $res_time <= 3600 * 24 * 30:$res_time = floor ( $res_time / 3600 * 24 );$res_time .= '天';break;default :$res_time = floor ( $res_time / 3600 * 24 );$res_time = 'N天';break;}//////////if ($view_type == 1) {$today = strtotime ( date ( 'Y-m-d', time () ) );$time = $today - 3600 * 24 * 7;$where = "and answertime >= $time";$viewtypecn = '本周';} elseif ($view_type == 2) {$today = strtotime ( date ( 'Y-m-d', time () ) );$time = $today - 3600 * 24 * 30;$where = "and answertime >= $time";$viewtypecn = '本月';} else {$where = '';$viewtypecn = '最新';}