/** * Notes: 获取时间节点 * 15分钟一个节点 从8:30 ~ 16:30,获取所有的时间节点 * $data 日期:2019-11-04 * Created by xxg@seabig.cn * Date: 2019/11/5 * Time: 13:35 */ public function dates($data = 0) { $this->_globals(); if ($data == 0) { $data = date("Y-m-d"); } $start = strtotime($data . '8:30:00'); $num = (strtotime($data . "16:30") - strtotime($data . "8:30")) / 900; $time = time(); //获取当前时间 //初始化 $arrtime = array(); for ($x = 0; $x <= $num; $x++) { $itme = array( 'start_time' => date("H:i", $start), 'edu_time' => date("H:i", ($start + 900)), ); if ($start > $time) { $itme['status'] = "可以"; } else { $itme['status'] = "不可以"; } $arrtime[] = $itme; $start += 900; } print_r($arrtime); die; }