$arr = array();
$nowd = date(ym);
$arr[] = date(ym,strtotime(-6 month));
$arr[] = date(ym,strtotime(-5 month));
$arr[] = date(ym,strtotime(-4 month));
$arr[] = date(ym,strtotime(-3 month));
$arr[] = date(ym,strtotime(-2 month));
$arr[] = date(ym,strtotime(-1 month));
$arr[] = date(ym);
$arr[] = date(ym,strtotime(+1 month));
$arr[] = date(ym,strtotime(+2 month));
$arr[] = date(ym,strtotime(+3 month));
$arr[] = date(ym,strtotime(+4 month));
$arr[] = date(ym,strtotime(+5 month));
$arr[] = date(ym,strtotime(+6 month));
for($i=0;$i echo .$arr[$i].,;
if($i%3==0)
echo '
';
}
?>
打印出来中间有2个 201203
201204不见了...
只有今天 2012 03 31 全天 的时候出现 平时都是正常的,求分析...
测试的时候请各位把日期设置为3.31号看看.
------解决方案--------------------
还是用你的代码
$nowd = date(y-m-1);
把形如
$arr[] = date(ym,strtotime(-6 month));
都改成形如
$arr[] = date(ym,strtotime(-6 month $nowd));
就可以了
