~~~
//获取自然周
/**
* @param $month 2020-04
* @return array
*/
function getweeks($month){
$weeks =[];
$date = strtotime($month);
$enddate = strtotime('+1 months',strtotime($month));
while ($date<$enddate) {
$week = date('YW', $date);
if (!in_array($week,$weeks)){
array_push($weeks, $week);
};
$date = strtotime('+1 days',$date);
}
return $weeks;
}
~~~