php获取最近7天的日期 function get7day($time = '', $format='Y-m-d'){ $time = $time != '' ? $time : time(); //组合数据 $date = []; for ($i=0; $i<=6; $i++){ $date[$i] = date($format ,strtotime( '+' . $i-7 .' days', $time)); } return $date; }