<?php
date_default_timezone_set('Asia/Shanghai');
//本周第一天和最后一天
$w = date('w');//星期几
if($w==0){
$w=7;
}
//本周
$ww = $w-1;//开始减的天数
$rw = 7-$w;//结束加的天数
//上周
$lww = $ww+7;//开始减的天数
$lrw = $rw-7;//结束加的天数
//本周
$week_start = date('Y-m-d',strtotime("-{$ww} days"));
$week_end = date('Y-m-d',strtotime("+{$rw} days"));
echo $week_start;
echo "<br/>";
echo $week_end;
//上周
$last_week_start = date('Y-m-d',strtotime("-{$lww} days"));
$last_week_end = date('Y-m-d',strtotime("+{$lrw} days"));
echo "<br/>";
echo $last_week_start;
echo "<br/>";
echo $last_week_end;
//本月
$month_start = date('Y-m-01');
$month_end = date('Y-m-