Regularly implement php scripts

Source: Internet
Author: User
Scheduled execution of php scripts for children's shoes using php, the first thing people think of when planning tasks is linux and crontab. However, not all users use the linux system, and not all have independent servers. In this case, how can we use php to schedule tasks. The function used is: & nbsp; ignore_user_abort (), and set_time_limit regularly executes the php script.
For children's shoes using php, the first thing that comes to mind when planning tasks is linux and crontab. However, not all users use the linux system, and not all have independent servers. In this case, how can we use php to schedule tasks.

The functions used are: ignore_user_abort (), set_time_limit (0), sleep ($ interval)
This code only needs to close the browser once it runs, However, this method also has a problem, that is, when apache is restarted, the script is terminated and needs to be run again.

Ignore_user_abort (); // close the browser and run the PHP script. set_time_limit (0); // use set_time_limit (0) to allow unlimited execution of the program $ interval = 60*30; // run do every half an hour {// Here is the code you want to execute sleep ($ interval); // wait 5 minutes} while (true );


You can repost this article at will, but please mark the original source and author information and copyright statement in the form of hyperlinks during reprinting.
Author: zhao Yange, original link: http://www.o135.com /? P = 474 [copy this article link and send it to your friends]

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.