这两天要实现这样功能:
当达到某一条件时,让服务器发短信给用户,数量为多条。
基本思路: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....
}
Statement: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