PHP获取区间时间,用于统计补全等

in 前端 with 0 comment
$periods = Carbon::parse('2021-05-01')->daysUntil('2021-05-18');
        $periods = iterator_to_array($periods->map(function ($day) {
            $date = $day->toDateString();
            return [
                'date' => $date,
                'count' => 1,
            ];
        }));

        var_dump($periods);
Comments are closed.