【问题标题】:CodeIgniter Error : Message: Session: Configured driver 'files' was not found. AbortingCodeIgniter 错误:消息:会话:找不到配置的驱动程序“文件”。中止
【发布时间】:2016-10-26 18:01:11
【问题描述】:

类型:UnexpectedValueException

消息:会话:未找到配置的驱动程序“文件”。中止。

文件名:/var/www/html/m-ticket/system/libraries/Session/Session.php

行号:230

回溯:

文件:/var/www/html/m-ticket/application/controllers/Home.php 线路:8 函数:__构造

文件:/var/www/html/m-ticket/index.php 线路:292 函数:require_once

我从 Windows 复制了这个项目,我想把它放在 Linux 的 localhost/m-ticket (/var/www/html/m-ticket) 中,我更改了 base_url localhost/m-ticket 但我仍然得到了错误。

我读过这个 Session: Configured driver 'files' was not found. Aborting

但这并不能解决我的问题

这是我的 autoload.php

defined('BASEPATH') OR exit('No direct script access allowed');
$autoload['packages'] = array();
$autoload['libraries'] = array('database','session');
$autoload['drivers'] = array('files');
$autoload['helper'] = array('file');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array();

还有一个控制器中有一个助手

$this->load->helper(array('form', 'url', 'file', 'html', 'text', 'tgl', 'date'));

如果我从驱动程序自动加载中删除 files,它会返回 Type: UnexpectedValueException

【问题讨论】:

  • 很明显你没有找到files,因为它是一个助手而不是驱动程序,给我们看看你的自动加载文件
  • 谢谢 ..它确实解决了我的问题,但我仍然收到此错误无法加载请求的文件:helpers/files_helper.php
  • 它应该是 file 而不是 files ,,, 请务必查看 codeigniter 的用户指南:codeigniter.com/user_guide
  • 它没有给我遇到错误的文件,我必须在哪里更改它?
  • 在自动加载中,将files替换为助手中的file,让我将其发布为答案,并附上详细信息

标签: php codeigniter session


【解决方案1】:

首先files 不是一个有效的驱动程序,您正在寻找的是一个包含帮助处理文件的函数的file 帮助程序。 ,所以你要做的就是打开autoload.php

中删除files

$autoload['drivers'] = array('files'); // remove files from this array

并在助手中添加file

$autoload['helper'] = array('file');

因为file是助手而不是驱动,驱动可以是cachesessiondatabase

而且您似乎在保存会话时遇到问题,因此也执行以下步骤:

去:

application/config/

打开

config.php

找到$config['sess_save_path']并将其替换为:

$config['sess_save_path'] = sys_get_temp_dir();

【讨论】:

  • $autoload['drivers'] = array('files'); $autoload['helper'] = array('file');会是这样吗?我更改了它并收到此错误无法加载请求的类:文件
  • @MochamadLuckyPradana 你在保存自动加载文件吗? ,因为错误是 files ,但它是 file ,请仔细检查
  • 请发布您的整个 autoload.php 文件,我需要检查一下
  • @MochamadLuckyPradana,我看到了你的 autoload.php 文件,我告诉你从驱动程序中删除:files,去做吧。
  • 完成.. 但我收到此错误类型:UnexpectedValueException 消息:会话:未找到配置的驱动程序“文件”。中止。文件名:/var/www/html/m-ticket/system/libraries/Session/Session.php 行号:230 回溯:文件:/var/www/html/m-ticket/application/controllers/Home.php 行: 8 函数:__construct 文件:/var/www/html/m-ticket/index.php 行:292 函数:require_once
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-08-05
  • 1970-01-01
  • 1970-01-01
  • 2019-02-04
  • 1970-01-01
  • 2016-07-30
  • 2020-01-21
相关资源
最近更新 更多