function getmonsun(){ $curtime = time(); $curweekday = date('w'); //为0是 就是 星期七 $curweekday = $curweekday?$curweekday:7; $curmon = $curtime - ($curweekday-1)*86400; $cursun = $curtime + (7 - $curweekday)*86400; $cur['mon'] = $curmon; $cur['sun'] = $cursun; return $cur; } $cur = getmonsun(); echo date('Y-m-d',$cur['mon']); echo "<br>"; echo date('Y-m-d',$cur['sun']); }