PHP sleep delay

前端 未结 5 702
心在旅途
心在旅途 2020-12-14 06:52

In PHP, I want to put a number of second delay on each iteration of the loop.

for ($i=0; $i <= 10; $i++) {
    $file_exists=file_exists($location.$filenam         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 07:41

    Have you considered using a PHP Daemon script using supervisorD. I use it in multiple tasks that are required to be running all the time.

    The catch is making sure that each time you are running your script you check for memory resources. If its too high, stop the process and then let it restart itself up again.

    I have successfully used this process to be always checking database records for tasks to process.

    It might be overkill but worth considering.

提交回复
热议问题