// 计算开始日可结束日之间相差多少天
$datetime1 = new DateTime($fromDay);
$datetime2 = new DateTime($toDay);
$intDate = intval( $datetime1->diff($datetime2)->format('%a') );
for ($d=0; $d<=$intDate; $d++){
// 然后循环内部,用from + d days去计循环到 d的时候是哪一天
$day = date("Y/m/d",strtotime("+{$d} day",strtotime($fromDay)));
// 然后循环查询结果数据
for($i = 0;$i < count($result);$i++){
$date = $result[$i][0]['DATE']; // 查询结果的日期
if($day == $date){
// 处理数据
}
}
}