长时间睡眠()和超时 [英] Long sleep() and time-out's
本文介绍了长时间睡眠()和超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我写的剧本需要等待一段随机时间(1-300s)
在循环的每次迭代之间,例如。
while(条件){
做点什么
//等待1到5分钟
睡觉(兰特(1,300));
}
问题是,如果浏览器内部没有答案,浏览器会超时
约30秒。是否有一个PHP脚本睡眠的时间比Web应用程序不兼容?
更长的时间?任何
解决方案?
谢谢。
解决方案
Vincent Delporte写道:嗨
我写的剧本需要在循环的每次迭代之间等待一段时间(1-300s)
,例如,
while(条件){
做点什么//等待1到5分钟
睡觉(兰德(1,300));
问题是,如果浏览器在大约30秒内没有得到答案,则浏览器会超时。是否有一个PHP脚本睡眠的时间更长,与Web应用程序不兼容?任何工作?
提供一些虚假信息?
for(
I = 0;
I< =兰特(1,60);
Hi
The script I''m writing needs to wait a random amount of time (1-300s)
between each iteration of a loop, eg.
while(condition) {
do something
//wait between 1s and 5 minutes
sleep(rand(1,300));
}
Problem is, a browser times out if it doesn''t get an answer within
about 30 seconds. Is the idea of having a PHP script sleep for a
longer amount of time incompatible with web applications? Any
work-around?
Thank you.
解决方案
Vincent Delporte wrote:Hi
The script I''m writing needs to wait a random amount of time (1-300s)
between each iteration of a loop, eg.
while(condition) {
do something
//wait between 1s and 5 minutes
sleep(rand(1,300));
}
Problem is, a browser times out if it doesn''t get an answer within
about 30 seconds. Is the idea of having a PHP script sleep for a
longer amount of time incompatible with web applications? Any
work-around?
Feed some bogus information?
for(
i=0;
i<=rand(1,60);
这篇关于长时间睡眠()和超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文