1、第一种:
有参数传回,参数为:2023-12
$days = date('t', strtotime('2023-12'));
无参数
$year为当年,$month为当月
$days = date('t', strtotime($year . '-' . $month . '-01'));
2、第二种:
$year为当年,$month为当月3、
$firstday = mktime(0,0,0,$month,1,$year); //取所给年月的第一天的UNIX时间戳
$days = date('t',$firstday); //返回指定月份的天数
3、第三种:
$ndays = date("t"); //return the number of days for this month and this year
date("j",mktime(0,0,0,$month+1,0,$year));