php使用Carbon获取2个日期之间的日期
<?php
use Carbon\CarbonPeriod;
$period = CarbonPeriod::create('2022-06-14', '2022-06-20');
// Iterate over the period
foreach ($period as $date) {
echo $date->format('Y-m-d') ."\n";
}
//result
2022-06-14
2022-06-15
2022-06-16
2022-06-17
2022-06-18
2022-06-19
2022-06-20