function printDates($start,$end){
    $dt_start = strtotime($start);
    $dt_end = strtotime($end);
    while ($dt_start<=$dt_end){
        echo date('Y-m-d',$dt_start)."<br>";
        $dt_start = strtotime('+1 day',$dt_start);
    }
}
printDates('2019-1-1','2019-07-05');

输出结果如下: