php判断某个时间是否在一个时间段内

/**
* 判断当前时间是否在时间段内
* @return bool
*/
public function get_time(){
$Day = date('Y-m-d ',time());
$timeBegin = strtotime($Day."15:00".":00");
$timeEnd = strtotime($Day."21:00".":00");
$curr_time = time();
if($curr_time >= $timeBegin && $curr_time <= $timeEnd){
return true;
}
return false;
}
posted @ 2021-03-10 09:33  大海啊都是水啊水  阅读(402)  评论(0)    收藏  举报