PHP日期遍历

function date_range($date1,$date2){
	$timestamp1=strtotime($date1);
	$timestamp2=strtotime($date2);
	$days=($timestamp2-$timestamp1)/86400+1;
	$date=[];
	for($i=0;$i<$days;$i++){
		$date[]=date('Y-m-d',$timestamp1+(86400*$i));
	}
	return $date;
}

猜你喜欢

转载自blog.csdn.net/sr_www/article/details/82925801