//自动补0 $month = str_pad($month,2,"0",STR_PAD_LEFT); $day = $year."-".$month; $end = strtotime("{$day} +1 month -1 day");