The php function (ignore_user_abort) that can be executed after the browser is closed ). Run the code directly. copy the code as follows: ignore_user_abort (true); set whether to interrupt the script execution when the client is disconnected set_time_limit (0); $ filetmpig, directly run the code:
The code is as follows:
Ignore_user_abort (true); // Sets whether the script execution is interrupted when the client is disconnected.
Set_time_limit (0 );
$ File = '/tmp/ignore_user.txt ';
If (! File_exists ($ file )){
File_put_contents ($ file );
}
If (! $ Handle = fopen ($ file, 'A + B ')){
Echo "not open file:". $ file;
Exit;
}
$ I = 0;
While ($ I <100 ){
$ Time = date ("Y-m-d H: I: s", time ());
Echo $ time. "\ n ";
If (fwrite ($ handle, $ time. "\ n") === false ){
Echo "not write file:". $ file;
Exit;
}
Echo "write file time:". $ time. "\ n ";
$ I ++;
Sleep (2 );
}
Fclose ($ handle );
The pipeline code is as follows: ignore_user_abort (true); // Sets whether the script execution is interrupted when the client is disconnected. set_time_limit (0); $ file = '/tmp/ig...