/**
* 时间列表
* $interval 间隔X分钟
* */
function timeList($day=7,$time1='08:00',$time2='22:00',$interval=60){
$date_list = [];//日期列表
$today_date = strtotime(date('Y-m-d',time()));
for($i=0;$i<=$day;$i++){
$date_title = date('Y-m-d',$today_date+($i*86400));
$buff = array();
for($a=strtotime($time1) ;$a<=strtotime($time2) ; $a=$a+60*$interval){
$type = 1;
if($a>=strtotime(date('Y-m-d',$a).' 12:00')){
$type = 2;
}
$buff[] = [
'lable'=>($type==1) ? '上午' : '下午',
'type'=>$type,//1 上午 2 下午
'time'=>date("H:i",$a),
'date'=>$date_title,
'post_parameter'=>$date_title.' '.date("H:i",$a)
];
}
$date_list_temp = [];
$week_array = ["周日","周一","周二","周三","周四","周五","周六"];
$week = date("w",strtotime($date_title));
$lable = $week_array[$week];
if($date_title==date('Y-m-d',time())){
$lable = '今天';
}elseif(strtotime($date_title)==strtotime(date('Y-m-d',time()))+86400){
$lable = '明天';
}
$date_list_temp['date_title'] = date('m月d日',strtotime($date_title));
// $date_list_temp['date'] = $date_title;
$date_list_temp['lable'] = $lable;
$date_list_temp['hour'] = $buff;
$date_list[] = $date_list_temp;
}
return $date_list;
}