{"id":180,"date":"2013-10-30T16:04:31","date_gmt":"2013-10-30T13:04:31","guid":{"rendered":"http:\/\/meekconsulting.com\/?p=180"},"modified":"2022-01-08T16:26:32","modified_gmt":"2022-01-08T13:26:32","slug":"preventing-caching-in-php","status":"publish","type":"post","link":"https:\/\/meekconsulting.com\/?p=180","title":{"rendered":"Preventing caching in php"},"content":{"rendered":"<p>Sometimes when you have php programs that render data from databases, after updating the data from a webpage the server will cache the results from before the update effectively showing wrong data.<\/p>\n<p>We found this to be especially problematic with MSIE. Internet Explorer seems to try to re-use the data when we navigate between jquery tabs in IE.<\/p>\n<p>To fix this we made the programs that render the tab content send these HTTP headers to prevent cacheing:<\/p>\n<blockquote><p>\/\/Set no caching<br \/>\nheader(\u201cExpires: Mon, 28 Jul 1997 05:00:00 GMT\u201d);<br \/>\nheader(\u201cLast-Modified: \u201d . gmdate(\u201cD, d M Y H:i:s\u201d) . \u201d GMT\u201d);<br \/>\nheader(\u201cCache-Control: no-store, no-cache, must-revalidate\u201d);<br \/>\nheader(\u201cCache-Control: post-check=0, pre-check=0\u201d, FALSE);<br \/>\nheader(\u201cPragma: no-cache\u201d);<\/p><\/blockquote>\n<p>This seems to solve the problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes when you have php programs that render data from databases, after updating the data from a webpage the server will cache the results from before the update effectively showing wrong data. We found this to be especially problematic with &hellip; <a href=\"https:\/\/meekconsulting.com\/?p=180\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/180"}],"collection":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=180"}],"version-history":[{"count":2,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/180\/revisions"}],"predecessor-version":[{"id":185,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=\/wp\/v2\/posts\/180\/revisions\/185"}],"wp:attachment":[{"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meekconsulting.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}