比如秒数时间很长,可以通过这段代码转换成几年几月几日的形式
$time = time() - $time; $points = array( 'year' => 31556926, 'month' => 2629743, 'week' => 604800, 'day' => 86400, 'hour' => 3600, 'minute' => 60, 'second' => 1 ); foreach($points as $point => $value) { if($elapsed = floor($time/$value) > 0) { $s = $elapsed>1?'s':''; $timestamp = "$elapsed $point$s"; break; } }