Re: header & headers_sent BUG
| From: | Marek Kilimajer | Date: | Wed, 23 Jul 2003 11:51:17 +0000 |
| Subject: | Re: header & headers_sent BUG | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-156433@lists.php.net to get a copy of this message | ||
Added to this, your later header replaces the earlier one of the same type, unless you specify false to the second parameter of header() function.
More in the manual.
Ford, Mike [LSS] wrote:
-----Original Message----- From: James M. Luedke [mailto:james@dod.net] Sent: 22 July 2003 07:07 I am having a hard time with a small piece of code. I was wondering if someone may be able to explain why the following code will not work... I have been scratching my head for a few hours now and I am stumped. <?php header("Location: http://someplace.com");At this point, you have specified that you want the header "Location: http://someplace.com" to be sent when headers are sent -- but headers are not sent until you output some actual content to your page. So...if( ! headers_sent())... headers haven't been sent yet, so this test always triggers, so...... this call always executes, specifying that, actually, you want *this* Location header to be sent when headers are sent, not the one specified before. I haven't the faintest idea what you might be trying to achieve here, but I think you need to rethink the logic of how you choose which redirect to use. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.ukheader("Location: http://somplaceelse.com");Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211