两个日期之间的所有时间

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

function DateRange ($begin,$end,$interval='M'){
	$begin = new DateTime($begin);
	$end   = new DateTime($end);
	$end = $end->modify('+1 day');
	$t ='P1'.$interval;
	$interval = new DateInterval($t);
	$daterange = new DatePeriod($begin, $interval ,$end);

	foreach($daterange as $date){
		$range[]= $date->format("Ymd");
	}
	return $range;
}