/**
*
* @param string $date 格式2023-05
* @return number
*/
function get_day($date) {
$tem = explode ( '-', $date );
$year = $tem ['0'];
$month = $tem ['1'];
if (in_array ( $month, array (1,3,5,7,8,01,03,05,07,08,10,12 ) )) {
$day = 31;
} elseif ($month == 2) {
if ($year % 400 == 0 || ($year % 4 == 0 && $year % 100 !== 0)) {
$day = 29;
} else {
$day = 28;
}
} else {
$day = 30;
}
return $day;
}
發(fā)表評(píng)論