Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
08-14-2007, 11:40 AM #1
- Join Date
- Sep 2006
- Thanked 0 Times in 0 Posts
Curious, Why did they call it Header
To redirect, or go to another page you use header();
To me that sounds like a heading, header, and head, of a page.
Footing, Footer, foot.
Is header the only one to redirect?
I just wonder because it seems weird.
This isn't ActionScript but it seems more logical to say GoToFrame(); and the like. Sorry the PHP Manual doesnt tell me WHY they do what they do all the time.
08-14-2007, 01:15 PM #2
- Join Date
- Sep 2005
- Thanked 36 Times in 35 Posts
When you make a request to a web-server for a page, it gives you back (normally, for a '200' successful request) 2 things, the 'content' of the page you requested, and a 'header' that contains meta-information, such as the content-type (whether it's HTML, a word document, an image etc.), when the page should expire (to help things get cached for a sensible amount of time), and so on.
When you want to redirect, you send back a header with a '3XX' status code (http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) indicating to the client (the web-browser) that there's not actually any content at the location they requested, but if they try somewhere else, they'll get it. That somewhere else is the 'location' that you include as part of the redirect.
header() then, isn't just for redirecting (although that is very common), but allows you to set arbitrary http-headers that can affect how the content your serving is treated by the client.
08-14-2007, 01:31 PM #3