note 17487 added to ref.http
| From: | epsibrown at hotmail dot com | Date: | Tue, 11 Dec 2001 08:42:44 +0000 |
| Subject: | note 17487 added to ref.http | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-22498@lists.php.net to get a copy of this message | ||
Here's a small function that will make sure a page is redirected as instructed whether the http
headers have already been sent or not. This is especially neat with global "security
schemes", but remember that some client-side javascript is involved, so don't bet your
life on it.
<?php
function redirectMe($url="/") {
if (!header_sent()) {
header("Location:".$url);
} else {
echo ("<script
language='Javascript'>top.location.href='$url';</script>");
}
}
?>
Enjoy!
--
http://www.php.net/manual/en/ref.http.php
http://master.php.net/manage/user-notes.php?action=edit+17487
http://master.php.net/manage/user-notes.php?action=delete+17487
http://master.php.net/manage/user-notes.php?action=reject+17487