Reputation: 1914
I tested this script that I found on this web site:
function setExpires($expires) {
header(
'Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
}
setExpires(10);
echo ( 'This page will self destruct in 10 seconds<br />' );
echo ( 'The GMT is now '.gmdate('H:i:s').'<br />' );
echo ( '<a href="'.$_SERVER['PHP_SELF'].'">View Again</a><br />' );
When I refresh the page, the time updates every sec instead of every 10 sec.
"If we follow this link, we’ll notice the time updates only once every ten seconds"
Upvotes: 1
Views: 616
Reputation: 173652
Okay, I'm hoping you didn't make this typo, but I'll point it out to you anyway:
header('Expires: '.gmdate('D, d M Y H:i:s', time()+$expires).'GMT');
Should have a space behind the seconds
field:
header('Expires: '.gmdate('D, d M Y H:i:s ', time()+$expires).'GMT');
// ^-- add space here
Upvotes: 1