Re: [PHP4BETA] Header() in PHP4
| From: | Peter Holt Hoffman | Date: | Wed, 25 Aug 1999 16:41:56 +0000 |
| Subject: | Re: [PHP4BETA] Header() in PHP4 | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3723@lists.php.net to get a copy of this message | ||
From: Samuel Liddicott <sam@campbellsci.co.uk>
> > From: Peter Holt Hoffman [mailto:peter@ibanksys.com]
> > First, I thought that the reason that header() has to be called first is
> > because it generates HTTP statements as opposed to HTML? I.e.,
> > the standard
> > says that all headers have to be sent first? For example, the
> > browser can't
> > be sent:
> >
> > <html>
> > <head>
> > <title>Hi</title>
> > Location: http://www.mysite.com/
>
> You can with php4 unless you turn off output buffering. php4 effectively
> builds up the output stream seperatly from the list of headers.
My example was showing literally what the browser would receive, not the
order in which the program was generating output.
I am effectively doing the same thing wrt to buffering in PHP3 by creating
the entire page and then sending any desired headers followed by the
page once I know exactly what will need to be sent (i.e., errors have been
handled or whatever).
My understanding of what Michael Stearne was saying in:
Either way is easy to use, but there is sometimes an advantage in
running some output before the page is redirected. I know this can be
done with a <META> tag, but I don't like the fact that the user can hit
Stop on the browser.
was that in this case the browser was receiving some HTML and then receiving
an HTTP redirect. As far as I know, that isn't standard. I was suggesting
that an approach is to do what I am doing because then you can make whatever
decisions you need to before starting to talk to the browser.
-- Peter.