PHP uses javascript-setInterval to execute a function at intervals.

Source: Internet
Author: User
PHP automatically executes (pause) a page at a certain time. when sending an email, you cannot send all submitted emails at once, at first, I thought of the sleep () function in PHP.

PHP automatically executes (pause) a page at a certain time. when sending an email, you cannot send all submitted emails at once, at first, I thought of the sleep () function in PHP, but sleep didn't actually sleep. PHP used javascript-setInterval to execute a function cyclically at intervals. let's talk about the specific usage of setInterval:
SetInterval ("function", time); parameter 1. customize a function. parameter 2. interval

The following uses my project as an example: PHP uses javascript to execute an instance before a project cyclically at intervals:
 

XML/HTML code
  1. Function UpdateNew ()
  2. {
  3. UpdateMe ("54545.php ");
  4. }
  5. Script
  6. Updated on:
  7. OnClick = "var t = parseInt (jj. value); setInterval (UpdateNew (), t);"/>

 


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.