Ignore_user_abort function Implementation method of PHP planning task, ignoreuserabort_php Tutorial

Source: Internet
Author: User

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. ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.