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]