Scheduled task software PHP gets the timestamp of a certain period of time PHP scheduled task

WBOY
Release: 2016-07-29 08:48:23
Original
860 people have browsed it

In the past two days, we will implement the following functions:
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 to get this time range every day?
Please see

Copy the 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....
}

The above introduces the scheduled task software PHP to get the timestamp of a certain period of time. PHP scheduled tasks include the content of scheduled task software. I hope it will be helpful to friends who are interested in PHP tutorials.

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