使用mktime獲得月份不能在PHP 7.0中工作。PHP 7.0 mktime不能正常工作
$month_options="";
for($i = 1; $i <= 12; $i++) {
$month_num = str_pad($i, 2, 0, STR_PAD_LEFT);
$month_name = date('F', mktime(0, 0, 0, $i + 1, 0, 0, 0));
$selected="";
$month_options.$month_name."<br/>";
}
echo $month_options;
結果在PHP 5.5
January
February
March
April
May
June
July
August
September
October
November
December
結果在7.0
January
January
January
January
January
January
January
January
January
January
January
請幫助我如何reslove這個問題?..謝謝提前
什麼用的$ month_num?你爲什麼在mktime賺$ i + 1? – bfahmi
它沒有在使用,我忘記評論該線..吸收 – sridhard
根據文檔http://php.net/manual/en/function.mktime.php *「is_dst參數已被刪除。」* –