Timeout a function in PHP

后端 未结 7 1999
时光说笑
时光说笑 2020-11-29 07:43

Is there a way to timeout a function? I have 10 minutes to perform a job. The job includes a for loop, here is an example:



        
7条回答
  •  迷失自我
    2020-11-29 07:59

    Take a look at set_time_limit. Now the function itself isn't really want you want as it only takes into consideration execution time, meaning 5 seconds in real life might still be only 0.2 seconds execution. But the reason for looking at the link is for the comments. There's a couple solutions that users have posted.

提交回复
热议问题