note 36346 added to function.header
| From: | Fred at rn2 dot php dot net | Date: | Mon, 06 Oct 2003 20:57:22 +0000 |
| Subject: | note 36346 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57908@lists.php.net to get a copy of this message | ||
Unless I missed something, there is an error in the code to make an absolute URI from a relative
one, at the top of this page.
<?php
header("Location: http://".$_SERVER['HTTP_HOST']."/"
.dirname($_SERVER['PHP_SELF'])."/".$relative_url);
?>
should read:
<?php
header("Location: http://$_SERVER[HTTP_HOST]"
.dirname($_SERVER[PHP_SELF])."/".$relative_url);
?>
unless you want to end up with things like "http://host///////directory/" in your
browser's adress bar after a couple repetitions, because dirname() keeps the leading
"/".
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36346
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36346&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36346&report=yes
Search -- http://master.php.net/manage/user-notes.php