Php, wait 5 seconds before executing an action

2020-02-24 07:31发布

I have a .php script that I use for creating the list of my products. I am on shared hosting, so I can't do a lot of queries otherwise I get a blank page.

This is how I use my script now:

script.php?start=0&end=500&indexOfFile=0  ->> make a product0.txt file with first 500 products

script.php?start=501&end=1000&indexOfFile=1 ->> product1.txt file with another 500 products

script.php?start=1001&end=1500&indexOfFile=2 ->> product2.txt file with last 500 products

How can I modify the script so it will make all these files automatically, so that I don't have to change each time the link manually?

I would like to click a button which will do this:

make the product0.txt file with the first 500 products

wait 5 seconds

make the product1.txt file with with another 500 products

wait 5 seconds

make the product2.txt file with the last 500 products

标签: php
7条回答
来,给爷笑一个
2楼-- · 2020-02-24 08:00

use:

sleep(NUMBER_OF_SECONDS);
查看更多
登录 后发表回答