代码:
$arr[0]= time()-((date('w')==0?7:date('w'))-1)*24*3600; $arr[1]= time()-((date('w')==0?7:date('w'))-2)*24*3600; $arr[2]= time()-((date('w')==0?7:date('w'))-3)*24*3600; $arr[3]= time()-((date('w')==0?7:date('w'))-4)*24*3600; $arr[4]= time()-((date('w')==0?7:date('w'))-5)*24*3600; $arr[5]= time()-((date('w')==0?7:date('w'))-6)*24*3600; $arr[6]= time()-((date('w')==0?7:date('w'))-7)*24*3600;$new=array();foreach($arr as $k=>$v){ $new[$k]['start']=mktime(0,0,0,date("m",$v),date("d",$v),date("Y",$v)); $new[$k]['end']= mktime(23,59,59,date("m",$v),date("d",$v),date("Y",$v));}效果: