为什么Codeigniter使用名称控制器+函数创建缓存文件


why codeigniter creates a cache file with name controller+function?

>我在codeigniter框架上建立了一个网站,我注意到根目录上的一些文件夹使用PHPStorm的名称控制器+函数(例如:welcome+index)。这些文件夹具有页面的缓存文件。

问题是我没有在我的代码中添加任何缓存语句,即使我删除了它们,它们也会自动重新创建自己。

有谁知道为什么要重新创建这些文件以及如何禁用此功能?

$db['default']['cache_on'] = TRUE;

使这个错误在您的配置数据库中.php

这里_output()方法写缓存文件(如果启用了缓存),而任何控制器(having _output()方法)调用。

您可以通过以下代码禁用缓存:

    /*cache control*/
    $this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
    $this->output->set_header('Pragma: no-cache');
    $this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 

只需将上面的代码放在控制器的__construct函数中即可。