Re: question on header() function
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Tue, 11 Nov 2008 06:30:45 -0500
JRough wrote:
On Nov 10, 8:23 pm, gordonb.a5...@xxxxxxxxxxx (Gordon Burditt) wrote:thanks, so the cache is in the browser page displayed and if the dataWhat is the purpose of caching in the header below? I usedGenerally, headers like this encourage a browser to get UP-TO-DATE
something like this for downloading a detail page to Excel but in this
example it looks like it is for cache control? Why would you expire a
header? So the user couldn't send a request after too long of a period
for example in the downloaded excel page?
dynamic content from the server, as distinguished from old data in
its cache.
<?phpYes. There are several types of errors that can be returned (page
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the
past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always
modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/
1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
Also, what is the status header for or rather how does it work? You
can get some status information from the server?
not found, page moved temporarily, page moved permanently, access
denied, page found OK, etc.) Certain status codes encourage the
browser to try again with a different URL, or to ask the user for
authentication information and resubmit the request.
Is this sent inThis header is being sent FROM THE SERVER. Do you think it is
conjunction with a header request? What is not found the page or the
server?
likely that the server will send an error code that the server
wasn't found?
header(“Status: 404 Not Found”);
changed it would get more recent data than the expired data on the
page unless you wanted the user to download the same data as what he
originally saw on the page. In any case it is the veriation in the
data at that moment in time viewed by the user and some other later
date in case
he leaves his browser open for awhile then decides to download the
data later.
What is the boolean replace function for in the header function?
thanks
No, the cache is in the browser. The page cannot cache itself.
Also, it doesn't matter if the browser is left open or not. Cache can also be stored on disk and used even after you reboot.
As to the replace parameter - from the manual:
"The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type. "
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- question on header() function
- From: JRough
- Re: question on header() function
- From: Gordon Burditt
- Re: question on header() function
- From: JRough
- question on header() function
- Prev by Date: Re: nesting JS in echo's
- Next by Date: Re: How to send email using the mail function on Windows XP?
- Previous by thread: Re: question on header() function
- Next by thread: How to send email using the mail function on Windows XP?
- Index(es):
Relevant Pages
|