[sleep()内部嵌套为循环不起作用

问题描述 投票:-1回答:1

我有一个嵌套的for循环,需要延迟大约10秒钟才能继续处理下一组数据。

for($i=0; $i<10; $i++)
{
   sleep(10);
   for($j=0; $j<80; $j++)
   {
    echo "asd :".$j."<br />";
   }
   echo "def :".$i."<br />";
}

通过这种方式,每80个关键字睡眠10秒钟便会进行一次抓取,然后继续进行下一组操作。在前80个关键字之后无效。

php sleep
1个回答
0
投票
It is working fine and it also going on the next group set also.
if you want to go to the 80 count than you should replace in the second for loop condition with this ($j<=80)

如果还有其他问题与该问题相关,则不告诉

© www.soinside.com 2019 - 2024. All rights reserved.