~~~
//获取一周周一到周日
/**
* @param $week 202010
* @return array
*/
function getonweek($week){
$year = substr($week,0,4);
$year_one_day = strtotime($year.'-01-01');
$week_day= date('w',$year_one_day);
$sub_num =$week_day-1;
if ($week_day==0){
$sub_num=6 ;
}
$week_num = substr($week,4,6);
$start_day=$year_one_day+(($week_num-1)*7-$sub_num)*24*60*60;
$oneweek=[];
for ($i=0;$i<7;$i++){
array_push($oneweek,date('Y-m-d',$start_day)) ;
$start_day=$start_day+24*60*60;
}
return $oneweek;
}
~~~