Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 缓存库未加载_Php_Codeigniter - Fatal编程技术网

Php 缓存库未加载

Php 缓存库未加载,php,codeigniter,Php,Codeigniter,在codeigniter(2.1.3)中加载缓存库时出错。 它所说的是: 遇到错误 无法加载请求的类:缓存 我的代码如下所示 if (!$data['foo'] = $this->cache->file->get('details')) { $data['foo'] = $this->foo->getdetails(); $this->cache->file->save('details', $data['foo']

在codeigniter(2.1.3)中加载缓存库时出错。 它所说的是:

遇到错误

无法加载请求的类:缓存

我的代码如下所示

if (!$data['foo'] = $this->cache->file->get('details')) {
        $data['foo'] = $this->foo->getdetails();
        $this->cache->file->save('details', $data['foo'], 600);
    }
我的自动加载文件如下所示:

$autoload['libraries'] = array('database','form_validation','session','driver','cache');

确保没有丢失CI的加载库函数。。。看起来你没有加载这个类

在任何控制器函数中,您都可以使用以下标准初始化类:$this->load->library('someclass')

试试这个

$this->load->library('cache');  //library name  // put it on your controller..

这是

我认为您需要先加载缓存库。您可以这样做:

$this->load->library('cache');

或者你可以把缓存库放在你的autoload.php中,大家好,我已经得到了这个问题的答案

最后,我创建了一个自定义库,并在自动加载文件中调用它。它解决了我的问题

代码在这里

class CallCache  {

public function __construct($config = array())
{
            $ci = &get_instance();
            $ci->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file')); 
}
}       

最后感谢上帝

我的解决方案是在系统文件夹中将文件夹名称从“libraries/cache”重命名为“libraries/cache:)


Loader使用ucfirst()将文件夹名称的首字母大写,并在其中搜索以查找驱动程序。

比较本地和服务器上的php版本如何。。我曾经针对charset utf-8做过这项工作,结果表明,如果您的php版本低于5.4或本机版本,CI将无法正常工作。您必须在cpanel或服务器正在使用的任何东西中升级它。干杯

你确实可以做到这一点

$autoload['drivers'] = array('cache');

已经这么做了。在我的本地服务器上工作正常,但在服务器上没有。$autoload['libraries']=array('database'、'form_validation'、'session'、'driver'、'cache');大家好,我已经得到了这个问题的答案。在你的服务器上将你的php升级到5.5版