note 89177 modified in features.connection-handling by danbrown
| From: | danbrown@php.net | Date: | Mon, 07 Mar 2011 18:27:26 +0000 |
| Subject: | note 89177 modified in features.connection-handling by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177633@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...
<?php
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 won't work if the output has started - but the a simple redirect wouldn't
work anyway.
UPDATE: To get this to work on IIS 7 you need to switch off IIS output buffering by adding
responseBufferLimit="0" to the relevant handler in your web.config
Thanks for the tip arr1
--was--
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...
<?php
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
http://php.net/manual/en/features.connection-handling.php