时间:2021-07-01 10:21:17 帮助过:32人阅读
for($i=1;$i<=12;$i++){
$nextdate = date("Y-m",strtotime("+ $i month"));
echo ''.$nextdate;
}
// 参数表示好多个月,你也可以修改为指定日期开始
function c($num = 12){
$temp = array();
$nowtime = strtotime( date('Y-m', time()) . '-1' );
while( $num>0 ){
$num--;
$nowtime = strtotime( '+1 month', $nowtime );
$temp[] = date('Y-m', $nowtime);
}
unset( $num, $nowtime );
return $temp;
}
print_r( c() );