> Hi Mr. Lerdorf,
> I look forward to you upcoming O'Reilly PHP book. =)
>
> Yes, a META tag refresh or Javascript control seems to be the only way left.
> Strange that URL redirection is so unusual to implement in PHP compared to
> ASP or Coldfusion (unless they do something klunky under the hood).

They do. There is no magic here. If you want output on a page and also do
a redirect, the only way to do it is with a javascript meta-refresh (well,
you can do some tricks with frames as well, but I lump those tricks under
Javascript redirects). I don't care what ASP of Cold Fusion tells you, if
they allow you to send some data for the page and then redirect, then they
are either doing a Javascript meta-refresh or simply tossing your data and
doing a Location redirect.

If you have no output, then you can use a Location redirect.  What ASP and
Cond Fusion might do is buffer your output and simply throw it away if you
then at some point do a Location redirect.  That seems kind of silly to me
though.  It seems like a mistake to me to just chuck away output data like
that.  You can do that with PHP as well by turning on output buffering.
You can send all sorts of output after a Location redirect, but there will
be no browser around to see it because it has already received the
Location redirect and is off viewing the other page.

> Anyway, I also noticed that when the manual says you cannot output ANYTHING,
> I found out that if I close out all my spaces in the PHP page by tightening
> the php container tags, I will not output anything first.  I forgot that
> even whitespace would be considered a web page and would generate http
> headers (since the PHP processor probably translates whitespace as
> echo/print statements).

Yup, a space is as valid a character as any other.

-Rasmus

PS. One of the things with PHP is that we have never gone out of our way
to hide the actual mechanics of HTTP very much from the users.  I think it
is important for people to actually understand what is going on.  That's
why we don't have a redirect() function but instead tell you to send an
HTTP header called Location.  Because that is what needs to happen under
the covers.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to