Home >Backend Development >PHP Tutorial >Scheduled task software PHP gets the timestamp of a certain period of time PHP scheduled task
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.