note 103426 added to function.header
| From: | polo at polosson dot com | Date: | Tue, 12 Apr 2011 15:17:50 +0000 |
| Subject: | note 103426 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178778@lists.php.net to get a copy of this message | ||
It seems that Internet Explorer can not execute an @ before the function 'header
("location: $ page")' (to ignore it if the contained variable is not defined). At
launch, IE loads the page indefinitely, without displaying anything (not even an error message) as
if there were an infinite loop of redirection.
However, Firefox supports this escape character and passes through the 'header()' without
running it, and everything goes well. I am not able to explain why, but I wanted to say that in
order to help those like me who have lost a lot of time with this problem!
Example:
My original code was :
<?php
@header("Location: $redirection") ;
?>
and to make it work with Internet Explorer, I had to replace it with :
<?php
if (isset($redirection)) {
header("Location: $redirection") ;
}
?>
Sincerely,
. Polosson
----
Server IP: 89.31.146.176
Probable Submitter: 93.27.139.143
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/103426
Del: integrated -- https://master.php.net/note/delete/103426/integrated
Del: useless -- https://master.php.net/note/delete/103426/useless
Del: bad code -- https://master.php.net/note/delete/103426/bad+code
Del: spam -- https://master.php.net/note/delete/103426/spam
Del: non-english -- https://master.php.net/note/delete/103426/non-english
Del: in docs -- https://master.php.net/note/delete/103426/in+docs
Del: other reasons-- https://master.php.net/note/delete/103426
Reject -- https://master.php.net/note/reject/103426
Search -- https://master.php.net/manage/user-notes.php