下面是最易犯错的代码:$date_start = mktime(0, 0, 0, 1, 1, 2010);$date_end = mktime(0, 0, 0, 4, 15, 2014);for($tm = $date_end; $tm >= $date_start; $tm -= 86400){$year = date(‘Y’, $tm);$month = date(‘m’, $tm);$day = date(‘d’, $tm);echo date(‘Y-m-d H:i:s’, $tm) . “\n”;}下面是正确的代码:for($tm = $date_end; $tm >= $date_start; $tm -= 40000){$year = date(‘Y’, $tm);$month = date(‘m’, $tm);$day = date(‘d’, $tm);echo date(‘Y-m-d H:i:s’, $tm) . “\n”;$tm = mktime(0, 0, 0, $month, $day, $year);}或者下面的代码也正确
...
继续阅读
(19)