PHP gets the timestamp php timing task for a period of time
- 2020-05-16 06:33:51
- OfStack
In these two days, the following functions will be implemented:
When a certain 1 condition is reached, let the server send a message to the user, the number is multiple.
Basic idea: linux regularly scans and sends SMS messages to users who meet the requirements.
However, in order to avoid disturbing users, it is required to send SMS messages only between 8:00 and 20:00 during the day. How can I get to this time of day?
Please have a look at
When a certain 1 condition is reached, let the server send a message to the user, the number is multiple.
Basic idea: linux regularly scans and sends SMS messages to users who meet the requirements.
However, in order to avoid disturbing users, it is required to send SMS messages only between 8:00 and 20:00 during the day. How can I get to this time of day?
Please have a look at
$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....
}