header()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yamobe
Forum Newbie
Posts: 13
Joined: Mon Jun 19, 2006 9:42 am

header()

Post by yamobe »

Hi, can someone explain as I was a five years old boy step by step what this is?

Code: Select all

header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");

my code is:

Code: Select all

<?php
	header("Cache-Control: no-store, no-cache, must-revalidate");
	header("Pragma: no-cache");
    $mifichero = "C:\posicion.txt";
    $posicion=array();
    $referencia=array();
    if ($mi_array=file($mifichero)) {
        list ($linea, $contenido) = each ($mi_array);
    }
    echo $contenido;
?>
And I get a 5 seconds delay in the value of $contenido, no matter if I am on the server or in another country... And I am calling this function every second

thanks for the help
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Those two lines are telling the browser to not store static cached copies of the pages content on the client machine and every time the page loads, to load from the server instead of the local cache copy, I believe.
yamobe
Forum Newbie
Posts: 13
Joined: Mon Jun 19, 2006 9:42 am

Post by yamobe »

Everah wrote:Those two lines are telling the browser to not store static cached copies of the pages content on the client machine and every time the page loads, to load from the server instead of the local cache copy, I believe.
thanks, that's exactly what I needed to know :D
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Everah wrote:Those two lines are telling the browser to not store static cached copies of the pages content on the client machine and every time the page loads, to load from the server instead of the local cache copy, I believe.
Whether they actually work or not is a matter of debate.
User avatar
julian_lp
Forum Contributor
Posts: 121
Joined: Sun Jul 09, 2006 1:00 am
Location: la plata - argentina

Post by julian_lp »

ole wrote:
Everah wrote:Those two lines are telling the browser to not store static cached copies of the pages content on the client machine and every time the page loads, to load from the server instead of the local cache copy, I believe.
Whether they actually work or not is a matter of debate.

I guess you could try changing images' content (not changing their file names), and load the page again to see what happens...
Post Reply