标签:
// 获取二十四个月份 function allMonth($start,$end){ $startTime = strtotime($start.‘01‘); $monthArr = array(); $i=0; while (1) { $nowTime = strtotime(‘+‘.$i.‘ month‘,$startTime); $month = date(‘Ym‘,$nowTime); if ($month>$end) { break; }else{ $monthArr[]= $month; } $i++; } return $monthArr; } $end = date(‘Ym‘,time()); $start = date(‘Ym‘,strtotime(‘-24 month‘,strtotime($end))); $result = allMonth($start,$end); echo ‘<pre>‘; print_r($result);
标签:
原文地址:http://www.cnblogs.com/xuedong/p/5045621.html