note 62898 deleted from function.register-shutdown-function by crell

From: Date: Thu, 31 Mar 2022 17:06:23 +0000
Subject: note 62898 deleted from function.register-shutdown-function by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217859@lists.php.net to get a copy of this message
Note Submitter: me at thomaskeller dot biz ---- 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 =)

« previous php.notes (#217859) next »