php经验方法1--判断当前时间是否在某一个时间段内

public function rangeTime($startTime,$endTime){
        $date = date("Ymd",time());
        //开始时间
        $start = strtotime($date.$startTime);
        $end = strtotime($date.$endTime);
        //当前时间
        $now = time();
        if($now >=$start && $now<=$end){
            return true;
        }else{
            return false;
        }
    }

猜你喜欢

转载自blog.csdn.net/weixin_38112233/article/details/80168317