Re: hard refresh or hard reload a page

From: Date: Sun, 25 Jun 2000 17:36:57 +0000
Subject: Re: hard refresh or hard reload a page
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3010@lists.php.net to get a copy of this message
Mark Lo <markloky@netvigator.com> wrote: > I would like to know how to force a page to reload or refresh in > PHP. Try writing some pseudo-code which illustrates what you want to obtain. No matter what, you'll probably have to explicitly make the page non-cacheable: <?php // Place this at the very top of the .php file header('Cache-Control: no-cache'); // HTTP 1.1; for IE header('Pragma: no-cache'); // HTTP 1.0; for Netscape // and old IEs header('Expires: Wed, 11 Feb 1998 10:40:21 GMT'); ... ?> If you want to send the browser somewhere, it's done by supplying the fully qualified URL in a "Location" HTTP header: header('Location: http://somewhere.someTLD/somepage.php'); The problems with this is that the header() request - again - has to be sent before any normal output is sent. Also, if you send people to the same URL as is currently being executed, then you have to account for the potential eternal loop situation; this may possibly be avoided by using a counting mechanism: At the URL http://somewhere.someTLD/somepage.php send people to http://somewhere.someTLD/somepage.php&horse=1 if horse is empty. -- Greetings from Troels Arvin, Copenhagen, Denmark

« previous php.general (#3010) next »