对于下面的代码,我想拥有当年的月份和接下来的 12 个月。我为它使用了一个循环,除了“一月”之外,一切都很好。我只是不知道出了什么问题。
for ($i = 0; $i <= 12; $i++) {
$months[ucfirst(strftime("%B %G", strtotime( date( 'Y-m' )." +$i months")))] = ucfirst(strftime("%B %G", strtotime( date( 'Y-m' )." +$i months")));
echo ucfirst(strftime("%B %G", strtotime( date( 'Y-m' )." +$i months")));
}
回声输出:
December 2015 Januari 2015 Februari 2016 Maart 2016 April 2016 Mei 2016 Juni 2016 Juli 2016 Augustus 2016 September 2016 Oktober 2016 November 2016 December 2016