PHP is relatively weak in this regard. if you only use php to implement it, you can: & amp; lt ;? Phpignore_user_abort (); // after closing the browser, run the php code set_time_limit (0
PHP is relatively weak in this regard. if you only use php, you can implement the following:
But when I execute the script, even if I close the browser, I cannot stop this program at all, so you need a script execution switch, you can use the method introduced by external files to implement the include switch variable during the while loop. Then we can achieve this:
Create an external variable file switch. php with the following content:
Return 1; // 1 run the script 0 exit the execution script
?>
The script for improvement is as follows:
This script is only feasible for testing and should be less efficient. for lamp, you can use crontab to implement it. I will post a tutorial later.