note 62898 added to function.register-shutdown-function
| From: | me at thomaskeller dot biz | Date: | Sat, 11 Mar 2006 22:27:28 +0000 |
| Subject: | note 62898 added to function.register-shutdown-function | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105320@lists.php.net to get a copy of this message | ||
Well, it might be obvious, but one should remember that one cannot send any HTTP header in the
shutdown callback.
Something like
<?php
function redirect()
{
header("Location: myuri.php");
}
register_shutdown_function("redirect");
// do something useful here
?>
doesn't work and PHP sends out the popular "headers already sent" warning.
I tried to set a redirection target somewhere in the script, but wanted to make sure that it was
only set/executed at the very end of the script, since my custom redirect function also cleaned any
output buffers at that point. Well, no luck here =)
----
Server IP: 66.163.161.117
Probable Submitter: 84.185.159.221
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php
Edit -- http://master.php.net/note/edit/62898
Del: integrated -- http://master.php.net/note/delete/62898/integrated
Del: useless -- http://master.php.net/note/delete/62898/useless
Del: bad code -- http://master.php.net/note/delete/62898/bad+code
Del: spam -- http://master.php.net/note/delete/62898/spam
Del: non-english -- http://master.php.net/note/delete/62898/non-english
Del: in docs -- http://master.php.net/note/delete/62898/in+docs
Del: other reasons-- http://master.php.net/note/delete/62898
Reject -- http://master.php.net/note/reject/62898
Search -- http://master.php.net/manage/user-notes.php