PHP Codeigniter is showing the cache when i press the back button after I logout
Hello sorry for saying that caching is not the problem. Caching is the problem! I fixed this by putting this code in the index.php file of the codeigniter.
header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");header("Cache-Control: no-store, no-cache, must-revalidate");
just add this to your controller
public function __construct() { parent::__construct(); $this->output->set_header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT'); $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate'); $this->output->set_header('Cache-Control: post-check=0, pre-check=0',false); $this->output->set_header('Pragma: no-cache'); }
REad this i think its very useful to you
https://www.codeigniter.com/user_guide/libraries/caching.html
https://www.codeigniter.com/user_guide/database/caching.html
and try this
$this->cache->clean();
or
$this->db->cache_delete_all();