I read (in a book) that you can prevent a page from caching by using the following script:
<?
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 Jul 1997 05:00:00 GMT");
?>
First I noticed that they did not include the 'php' in that script (as in '<? php'
The book says, "if used at the beginning of a PHP script".
If my script is, say, far example:
<?php
echo gmdate("l F d Y Hi");
?>
Would I prevent caching by code # 1 or 2:
#1:
<?
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 Jul 1997 05:00:00 GMT");
?>
<?php
echo gmdate("l F d Y Hi");
?>
#2:
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 Jul 1997 05:00:00 GMT");
echo gmdate("l F d Y Hi");
?>
Thx.
I hate being a newbie.