date('Y-m-d', (time() - ((date('w') == 0 ? 7 : date('w')) - 1) * 24 * 3600)); //获取本周一的时间
date('Y-m-d',strtotime('+1 week last monday'));//获取下周一的时间
function get_week($time = '', $format='Y-m-d'){
$time = $time != '' ? $time : time();
//获取当前周几
$week = date('w', $time);
$weekname = array('周一','周二','周三','周四','周五','周六','周日');
//星期日排到末位
if(empty($week)){
$week=7;
}
$date = [];
for ($i=0; $i<7; $i++){
$date_time = date($format ,strtotime( '+' . $i+1-$week .' days', $time));
$date[$i]['date'] = $date_time;
$date[$i]['time'] = strtotime($date_time);
$date[$i]['week'] = $weekname[$i];
}
return $date;
}
print_r(get_week(strtotime('2019-12-02'),'Y-m-d'));