PHP中 时间段的判断封装方法
/**
* 判断当前的时分是否在指定的时间段内
* @param $start 开始时分 eg:10:30
* @param $end 结束时分 eg:15:30
* @return: bool 1:在范围内,0:没在范围内
*/
public function checkIsBetweenTime($start, $end)
{
$date= date('H:i');
$curTime = strtotime($date);//当前时分
$assignTime1 = strtotime($start);//获得指定分钟时间戳,00:00
$assignTime2 = strtotime($end);//获得指定分钟时间戳,01:00
$result = 0;
if ($curTime>$assignTime1&&$curTime<$assignTime2) {
$result = 1;
}
return $result;
}