Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How to prevent Browser cache for php site

Here, if you want to control it through HTML: do like below Option 1:

<meta http-equiv="expires" content="Sun, 01 Jan 2014 00:00:00 GMT"/>
<meta http-equiv="pragma" content="no-cache" />
  
And if you want to control it through PHP: do it like below Option 2:

header('Expires: Sun, 01 Jan 2014 00:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');

AND Option 2 IS ALWAYS BETTER in order to avoid proxy based caching issue.
Comment

Clear php cache

apcu_clear_cache();
Comment

php clear cache

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: application/xml; charset=utf-8");
Comment

cache for php website

# Checks if the file is physically NOT present
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9-]+)+/([a-z0-9-]+).html$	/controller.php?partA=$1&partB=$2 [L]
Comment

PREVIOUS NEXT
Code Example
Php :: Unsupported type passed 
Php :: get user id trougt user code 
Php :: loop IlluminateSupportCollection Object ( [items:protected] = 
Php :: simple_html_dom stream does not support seeking 
Php :: Type cast using int php 
Php :: fat-free captcha plugin 
Php :: get product price with thousands separator 
Php :: how can we manage category and product in laravek 
Php :: how to keep some value on input field 
Php :: Laravel Read multiple file extensions 
Php :: How to display limited post content in WordPress 
Php :: How to append json array using jq+shell in a loop 
Php :: default php email prot 
Php :: executer page php via boutton 
Php :: How to increase the WordPress Multisite Network limit for Maximum Filesize Upload? 
Php :: update request php-salesforce-rest-api 
Php :: Pasar el email de recuperar contraseña de laravel a español 
Php :: Trying to get property 
Php :: how to get data from laravel api 
Php :: php send data from one page to another 
Php :: how to get the ip address of the client in php 
Php :: php pretty json 
Php :: Turn error log WP 
Php :: str_word_count() 
Php :: Append a text string to WooCommerce product title loop 
Java :: import android.support.v7.app.appcompatactivity error 
Java :: import android.support.v7.app.ActionBarActivity; 
Java :: javafx get screen size 
Java :: java lambda foreach multiple statements 
Java :: java for loop high to low 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =