how can i make a php page not be readed from cache?

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
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

how can i make a php page not be readed from cache?

Post by pelegk2 »

i have a php page that i load into an iframe
and when i refresh it it idosent update~
how can i force it to reload the page but not from the cache?
i know there is a possibility like that in ASP
how can i do the same in php?
thnaks in advance
peleg
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Use this meta-tag in your <head>:

Code: Select all

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

thanks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

In my experience, IE needs 3 of those types of tags to absolutely not cache a page. I also use header() as opposed to the meta tags:

Code: Select all

header("Cache-control: no-cache");
header("Expires: 0");
header("Pragma: no-cache");
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply