Home  >  Article  >  Backend Development  >  PHP gets the timestamp of a certain period of time php scheduled task_PHP tutorial

PHP gets the timestamp of a certain period of time php scheduled task_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:19:08858browse

In the past two days, we will implement this function:

When a certain condition is reached, let the server send multiple text messages to the user.

Basic idea: Linux scans regularly, and if there are users who meet the conditions, send text messages.

But in order to prevent disturbing users, it is required that text messages can only be sent between 8:00-20:00 during the day. How can I get this time range every day?

Please see

Copy code The code is as follows:

$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 <= $end_time)
{
// do something....
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325358.htmlTechArticleTo achieve this function in the past two days: When a certain condition is reached, let the server send text messages to the user, the number is Multiple. Basic idea: Linux scans regularly. If there are users who meet the conditions, send...
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