The Ignore_user_abort function implementation method of PHP planning task, Ignoreuserabort
In this paper, the Ignore_user_abort function implementation method of PHP planning task is described. Share to everyone for your reference. The specific analysis is as follows:
PHP does not detect if the user is disconnected until an attempt is made to send information to the client, simply using the Echo statement does not ensure that the information is sent, see the flush () function, the code is as follows:
Copy the Code code as follows: <?php
Ignore_user_abort (TRUE);
Set_time_limit (0);
while (1) {
$fp = fopen (' Time_task.txt ', "A +");
$STR = Date ("y-m-d h:i:s"). " NR ";
Fwrite ($fp, $STR);
Fclose ($FP);
Sleep (5); Execute once in half an hour
}
?>
Definition and usage
The Ignore_user_abort () function sets the execution of the script to terminate if the client disconnects, this function returns the previous value of the User-abort setting (a Boolean value).
Syntax: Ignore_user_abort (setting)
Parameters |
Describe |
Setting |
Optional, if set to true, the disconnect from the user is ignored, and if set to false causes the script to stop running, and if the parameter is not set, the current setting is returned. |
Hints and Notes
notes: PHP does not detect whether a user has been disconnected until an attempt is made to send information to the client, simply using the Echo statement does not ensure that the information is sent, see the flush () function.
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/939400.html www.bkjia.com true http://www.bkjia.com/PHPjc/939400.html techarticle The implementation method of Ignore_user_abort function of PHP program task, Ignoreuserabort the Ignore_user_abort function implementation method of PHP planning task in this paper. Share to everyone for your reference. ...