note 52366 added to function.header
| From: | mephistos at ighettomail dot com | Date: | Thu, 28 Apr 2005 18:06:18 +0000 |
| Subject: | note 52366 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88711@lists.php.net to get a copy of this message | ||
I hope this little redirection function might be useful to someone:
<?
function redirect($url = NULL, $relative = FALSE) {
header("Location: http://".$_SERVER['HTTP_HOST'].(($relative)
? dirname($_SERVER['PHP_SELF'])."/" : "/").$url);
exit;
}
?>
If no url is specified it will redirect to server root and if relative is set to true it will
redirect using a relavite path.
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52366
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52366&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52366&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52366&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52366&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52366&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52366&report=yes
Search -- http://master.php.net/manage/user-notes.php