php时间段判断
<?php function times(){ ini_set('date.timezone','Asia/Shanghai'); $time = date("Y-m-d H:i"); /*5.1*/ if($time>"2017-05-01 09:00" && $time<"2017-05-01 09:20"){ return "in"; } if($time>"2017-05-01 10:00" && $time<"2017-05-01 10:20"){ return "in"; } if($time>"2017-05-01 11:00" && $time<"2017-05-01 11:20"){ return "in"; } if($time>"2017-05-01 15:00" && $time<"2017-05-01 15:20"){ return "in"; } if($time>"2017-05-01 16:00" && $time<"2017-05-01 16:20"){ return "in"; } if($time>"2017-05-01 17:00" && $time<"2017-05-01 17:20"){ return "in"; } /*5.2*/ if($time>"2017-05-02 09:00" && $time<"2017-05-02 09:20"){ return "in"; } if($time>"2017-05-02 10:00" && $time<"2017-05-02 10:20"){ return "in"; } if($time>"2017-05-02 11:00" && $time<"2017-05-02 11:20"){ return "in"; } if($time>"2017-05-02 15:00" && $time<"2017-05-02 15:20"){ return "in"; } if($time>"2017-05-02 16:00" && $time<"2017-05-02 16:20"){ return "in"; } if($time>"2017-05-02 17:00" && $time<"2017-05-02 17:20"){ return "in"; } /*5.3*/ if($time>"2017-05-03 09:00" && $time<"2017-05-03 09:20"){ return "in"; } if($time>"2017-05-03 10:00" && $time<"2017-05-03 10:20"){ return "in"; } if($time>"2017-05-03 11:00" && $time<"2017-05-03 11:20"){ return "in"; } if($time>"2017-05-03 15:00" && $time<"2017-05-03 15:20"){ return "in"; } if($time>"2017-05-03 16:00" && $time<"2017-05-03 16:20"){ return "in"; } if($time>"2017-05-03 17:00" && $time<"2017-05-03 17:20"){ return "in"; } return "noin"; } ?>