Home  >  Article  >  Backend Development  >  Implementation of PHP scheduled tasks and scheduled execution tasks_PHP Tutorial

Implementation of PHP scheduled tasks and scheduled execution tasks_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 14:53:52786browse

Implementation of PHP scheduled tasks and scheduled execution tasks

The functions used ignore_user_abort(), set_time_limit(0), sleep($interval)
You only need to run this code once and then close the browser.
I don’t know if the performance of the program will be greatly affected!

ignore_user_abort();//Close the browser, and the PHP script can continue to execute.
set_time_limit(0);//The program can be executed without limit through set_time_limit(0)
$interval= 60*30;//Run every half hour
do{
//Here is the code you want to execute
sleep($interval);//Wait for 5 minutes
}while(true) ;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364761.htmlTechArticleFunction ignore_user_abort(),set_time_limit(0),sleep( $interval) This code only needs to be run once and then the browser is closed. I don’t know...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn