Php plan task: implement the ignore_user_abort implementation plan task in php-Linux general technology-Linux programming and kernel information. The following is a detailed description. Function-ignore_user_abort. This function can help us implement scheduled tasks like cron in linux. Let's take a look at how to implement it.
First, let's take a look at the php Manual's explanation of this function.
Description
Int ignore_user_abort ([bool $ setting])
Sets whether a client disconnect shocould cause a script to be aborted.
That is to say, the following program will be executed no matter whether the client closes the browser.
Let's look at its parameters.
Parameters
Setting
If not set, the function will only return the current setting.
This function accepts a parameter to determine whether to enable the ignore_user_abort function.
Let's look at the returned values:
Return Values
Returns the previous setting, as a boolean.
Here, the previous setting is returned and bool is worth it. After my test, this statement is incorrect. The returned result is of the int type, if you don't believe it, you can write a PHP file to test it.
After talking about this, how should we use the php function to implement the scheduled task? This function is set_time_limit. You can use set_time_limit0 to set the program execution time to no limit. The default php Execution time is 30 seconds, and set_time_limit (0) the program can be executed without limit. Before executing the program, add ignore_user_abort (1) and set_time_limit (0). How can I write the final program? Here is an example.