Home  >  Article  >  Backend Development  >  PHP计划任务、定时执行任务的实现代码_PHP教程

PHP计划任务、定时执行任务的实现代码_PHP教程

WBOY
WBOYOriginal
2016-07-21 15:30:00850browse

不知道能程序的性能会不会影响很大!

复制代码 代码如下:

ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行.
set_time_limit(0);// 通过set_time_limit(0)可以让程序无限制的执行下去
$interval=60*30;// 每隔半小时运行
do{
//这里是你要执行的代码
sleep($interval);// 等待5分钟
}while(true);

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/323272.htmlTechArticle不知道能程序的性能会不会影响很大! 复制代码 代码如下: ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行. set_time_limit(0);// 通过set...
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