// 时间间隔 public static function timeInterval(){ $req=self::app()->request(); $startTimeSlot=$req->post('startTimeSlot'); // 接收时间段开始区间 数字 $time=$startTimeSlot.':00'; // 拼接成00:00格式 $endTimeSlot=$req->post('endTimeSlot'); // 接收时间段结束区间 数字 $end = $endTimeSlot.':00'; // 拼接成00:00格式 $item=$req->post('interval'); // 接收时间间隔 $buff = array(); for($i=strtotime($time) ;$i<strtotime($end) ; $i=$i+60*60*$item){ $buff[]=date("H:i",$i); } $str = array(); $num = count($buff); foreach($buff as $key=>$val){ if($key < $num){ $time_str = strtotime($val); $str[] = array( 'start_time' => date('H:i',$time_str), 'end_time' =>date('H:i',$time_str + 60*60*$item) ); } } return $str; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。