The example in this article describes how to implement the ignore_user_abort function of PHP scheduled tasks. Share it with everyone for your reference. The specific analysis is as follows:
PHP will not detect whether the user has disconnected until trying to send information to the client. Simply using the echo statement cannot ensure that the information is sent. See the flush() function, the code is as follows:
ignore_user_abort() function sets whether disconnecting from the client will terminate the execution of the script. This function returns the previous value (a Boolean value) set by user-abort.
Syntax:ignore_user_abort(setting)
参数 | 描述 |
setting | 可选,如果设置为 true,则忽略与用户的断开,如果设置为 false,会导致脚本停止运行,如果未设置该参数,会返回当前的设置. |
Tips and Notes
Note:PHP will not detect whether the user has disconnected until trying to send information to the client. Simply using the echo statement cannot ensure that the information is sent, see the flush() function.
I hope this article will be helpful to everyone’s PHP programming design.