note 36408 added to function.header
| From: | fredmathieu8 at hotmail dot com | Date: | Wed, 08 Oct 2003 20:46:53 +0000 |
| Subject: | note 36408 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58074@lists.php.net to get a copy of this message | ||
Unless I missed something, there seems to be 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://www.domain///////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+36408
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36408&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36408&report=yes
Search -- http://master.php.net/manage/user-notes.php