0

i notice a thing about header function in php.....sometimes we used it as

1.header("Content-type: $contenttype"); //i saw this in a dynamic page
2.header("Content-type: $image/png"); //saw this in a captcha create page
3.header("location:bird.php"); // this one i understand
4.header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache"); //saw these in w3schools, says some cache-control

but i only get 3rd one(bird.php), didnt know what it actually does...so any help..??

4
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by almostbob
0
header("Content-type: $contenttype"); //to ensure the receiving pc can display the developed page in the correct way, the content type may be different for each object pulled from the database
header("Content-type: image/png"); //to ensure the receiving pc can display the developed page in the correct way, the normal content type for served php pages is text/html, likely the original did not have a dollar sign
header("location:bird.php"); // this one i understand, yep redirect
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache"); //each of these three to ensure the browser reloads the item from the server, make sure of the most recent version, expired 20 years ago, nocache for each of the two major object models

Edited by almostbob: n/a

0

You are doing it wrong, you are setting headers for the page, then sending the user elsewhere...

You need to set the headers, then do a readfile if you are opening a file

0

You are doing it wrong, you are setting headers for the page, then sending the user elsewhere...

You need to set the headers, then do a readfile if you are opening a file

bloke, the op is asking what the headers do, giving specific examples, we could have "let me google that for you" or sent him to read the manual http://php.net/manual/en/function.header.php but he showed some effort, has been examininig the source

Edited by almostbob: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.