Timed task software PHP gets time stamp for a time interval PHP timed task

Source: Internet
Author: User
These two days to achieve this function:
When a certain condition is reached, let the server send a message to the user, the number is more than one.
Basic idea: Linux timed scan, if you meet the conditions of the user, then send a text message.
But in order to prevent the interruption to the user, the request only during the daytime 8:00-20:00 send text messages, how to get to the daily time interval?
Please look

Copy the Code code 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 (0, 0, $m, $d, $y);
$time = time ();
if ($time >= $start _time && $time <= $end _time)
{
Do something ....
}

The above describes the timer task software PHP to get a time interval timestamp php timing task, including the timing task software aspects, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.