PHP auto-kill a script if the HTTP request is cancelled/closed

后端 未结 4 562
日久生厌
日久生厌 2020-12-01 15:11

The problem is that for a long process the PHP script keeps on executing whether or not the client browser is currently connected or not. Is there any possibility that if th

4条回答
  •  半阙折子戏
    2020-12-01 15:54

    Check out PHP connection_aborted() function. While doing your processing, you can sometimes check for the aborted connection to gracefully cancel the progress, as one would do in an interactive threading model.

提交回复
热议问题