PHP判断指定时间段的2个方法_PHP

WBOY
Release: 2016-06-01 11:55:38
Original
866 people have browsed it

一、包含小时和分钟的判断
复制代码 代码如下:date_default_timezone_set("Asia/Shanghai");
$time = intval (date("Hi"));
if ($time > "800" && $time     // code
}
二、只判断小时
复制代码 代码如下:date_default_timezone_set("Asia/Shanghai");
if(date('G')17)
{
    // code
}$h = intval(date("H"));
if ($h > 23 || $h  echo '这里是第一个任务';
} else {
 echo '这里是第二个任务';
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!