note 89177 added to features.connection-handling
| From: | alan at burrist dot co dot uk | Date: | Wed, 25 Feb 2009 12:57:37 +0000 |
| Subject: | note 89177 added to features.connection-handling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151101@lists.php.net to get a copy of this message | ||
A simple but useful packaging of arr1's suggestion for continuing processing after telling the
the browser that output is finished.
I always redirect when a request requires some processing (so we don't do it twice on refresh)
which makes things easy...
function redirect_and_continue($sURL)
{
header( "Location: ".$sURL ) ;
ob_end_clean(); //arr1s code
header("Connection: close");
ignore_user_abort();
ob_start();
header("Content-Length: 0");
ob_end_flush();
flush(); // end arr1s code
session_write_close(); // as pointed out by Anonymous
}
Of course this wont work if the output has started - but the a simple redirect wouldn't work
anyway.
Thanks for the tip arr1
----
Server IP: 80.67.2.2
Probable Submitter: 79.66.40.234
----
Manual Page -- http://www.php.net/manual/en/features.connection-handling.php
Edit -- https://master.php.net/note/edit/89177
Del: integrated -- https://master.php.net/note/delete/89177/integrated
Del: useless -- https://master.php.net/note/delete/89177/useless
Del: bad code -- https://master.php.net/note/delete/89177/bad+code
Del: spam -- https://master.php.net/note/delete/89177/spam
Del: non-english -- https://master.php.net/note/delete/89177/non-english
Del: in docs -- https://master.php.net/note/delete/89177/in+docs
Del: other reasons-- https://master.php.net/note/delete/89177
Reject -- https://master.php.net/note/reject/89177
Search -- https://master.php.net/manage/user-notes.php