note 46846 added to function.header
| From: | guvnor at osu1 dot php dot net | Date: | Mon, 25 Oct 2004 18:38:04 +0000 |
| Subject: | note 46846 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79081@lists.php.net to get a copy of this message | ||
One that tripped me up for a while...
When I use PHP sessions, the following headers are sent automatically to force the browser not to
cache:
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
If you are having trouble with inline PDFs etc., thses may be causing you problems. As per other
notes here if you overwrite these headers before outputting your file, the download problems will go
away.
header('Cache-Control:');
header('Pragma:');
If you wish to retain the dynamic content, only send the above if the document you are returning is
not HTML.
Its well worth examining your own headers (call your PHP script from another script using
get_headers() for instance) before going mad trying to fix something - better still compare the
headers from your script with headers from a static web page - it might save you hours of time.
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46846
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46846&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46846&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46846&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46846&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46846&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46846&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46846&report=yes
Search -- http://master.php.net/manage/user-notes.php