Home  >  Article  >  Backend Development  >  关于延时执行程序,该怎么处理

关于延时执行程序,该怎么处理

WBOY
WBOYOriginal
2016-06-13 11:52:281128browse

关于延时执行程序
有一个程序是这样的,我想每一分钟执行一个程序, 这个PHP的思路是怎么样,怎么写的呢
比如for (i=0;i程序逻辑
此处想延时一分钟再执行然后再进行下一次循环,请问这个怎么写呢或思路呢,好像php页面有规定多久就超时了
}
------解决方案--------------------
你这样页面就要一直开着,
set_time_limit(0); 可以使页面不超时
sleep(60); 可以让程序在此处睡眠60秒再执行之后的。

但不建议这样做,主要看你的逻辑,如果是每分钟走一次的。建议用crontab来做。
在终端输入


crontab -e
* * * * * php handle.php >> handle.log
:wq


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 [email protected]