gviaud icon

PHP "Fork" process (closes connection and keeps running)

gviaud | PRO | 07/28/16 06:00:19 PM UTC | 0 ⭐ | 229 👁️ | Never ⏰ | []
text |

370 B

|

None

|

0 👍

/

0 👎

// Close remote connection and continue
ob_end_clean();
ignore_user_abort(true);
header("Connection: close");
ob_start();
echo "The user will see this";
$size = ob_get_length();
header("Content-Length: $size");
ob_end_flush(); // Strange behaviour, will not work unless flush() is called immediately after!
flush();
// Fork complete!
 echo "The user will NOT see this";

Comments