Home > Backend Development > PHP Tutorial > PHP得到某段时间区间的时间戳 php定时任务_php实例

PHP得到某段时间区间的时间戳 php定时任务_php实例

WBOY
Release: 2016-06-07 17:25:34
Original
793 people have browsed it

这两天要实现这样功能:

当达到某一条件时,让服务器发短信给用户,数量为多条。

基本思路:linux 定时扫描,若有满足条件的用户,则发送短信。

但为了防止打扰到用户,要求只能在白天8:00-20:00发送短信,怎么样获得到每天的这段时间区间?

请看

复制代码 代码如下:

$y=date("Y",time());
$m=date("m",time());
$d=date("d",time());
$start_time = mktime(9, 0, 0, $m, $d ,$y);
$end_time = mktime(19, 0, 0, $m, $d ,$y);

$time = time();
if($time >= $start_time && $time {
// do something....
}
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