function isInWeek(){
$date = date("Y-m-d");
//当前日期
$first=1; //$first =1
表示每周星期一为开始时间 0表示每周日为开始时间
$w = date("w",
strtotime($date)); //获取当前周的第几天 周日是 0 周一 到周六是 1
-6
$d = $w ? $w - $first :
6; //如果是周日 -6天
$now_start =
date("Y-m-d", strtotime("$date -".$d." days")); //本周开始时间
$now_end = date("Y-m-d",
strtotime("$now_start +6 days")); //本周结束时间
return
array('start'=>$now_start,'end'=>$now_end);
//$last_start =
date('Y-m-d',strtotime("$now_start - 7 days"));
//上周开始时间
//$last_end =
date('Y-m-d',strtotime("$now_start - 1 days"));
//上周结束时间
}