我正在尝试并且仍然想知道如何获得一个包含当月所有日期的数组,它应该包含格式为:年-月-日的所有日期。感谢您的帮助!
Try:
// for each day in the month for($i = 1; $i <= date('t'); $i++) { // add the date to the dates array $dates[] = date('Y') . "-" . date('m') . "-" . str_pad($i, 2, '0', STR_PAD_LEFT); } // show the dates array var_dump($dates);