php获取两个日期之间的所有日期

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');

想要获取时间范围进行查询数据时,获取到就可以直接查询,不用再放到数组后再查询,这样就重复了

 https://www.cnblogs.com/ryanzheng/p/11140047.html

posted @ 2020-10-15 16:39  小林不会飞  阅读(1570)  评论(1编辑  收藏  举报