无法加载请求的类:Session Codeigniter 3 [英] Unable to load the requested class: Session Codeigniter 3

查看:543
本文介绍了无法加载请求的类:Session Codeigniter 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在Codeigniter中加载会话库。似乎很明显是正确的,但actully不工作。
这是配置文件的一部分:

  $ config ['sess_driver'] ='database'; 
$ config ['sess_cookie_name'] ='ci_session';
$ config ['sess_expiration'] = 7200;
$ config ['sess_save_path'] = NULL;
$ config ['sess_match_ip'] = FALSE;
$ config ['sess_time_to_update'] = 300;

此外,ncryption键变量已设置。此外,CI 3文档不能给我解决这个问题的方法。






我试图: / p>


  1. 将'sess_save_path'变量设为'ci_sessions'

  2. 检查文件夹权限

  3. 检查表'ci_sessions'是否存在

  4. 使用Autoloader类

  5. 使用具有大写S的类名






这很奇怪,但配置说:

  / * 
| -------------------------------------------------- -----------------
|自动加载库
| -------------------------------------------------- -----------------
|这些是位于system / www文件夹
|中的类或在您的应用程序/ www文件夹中。
|
|原型:
|
| $ autoload ['www'] = array('database','email','session');
|
|您还可以提供要分配的备用库名称
|在控制器:
|
| $ autoload ['www'] = array('user_agent'=>'ua');
* /

下面是自动加载器的代码:

  //载入www 
if(isset($ autoload ['www'])&& > 0)
{
//加载数据库驱动程序。
if(in_array('database',$ autoload ['www']))
{
$ this-> database
$ autoload ['www'] = array_diff($ autoload ['www'],array('database'));
}

//加载所有其他www
foreach($ autoload ['www'] as $ item)
{
$ this-> library($ item);
}
}


解决方案

您应该尝试的列表:


  1. 确保您在autload.php中加载会话库: $ autoload ['libraries'] = array('session');


  2. 确保您的加密密钥设置为cofing .php: $ config ['encryption_key'] ='anything_here'


  3. 被命名为 ci_sessions ,并且您的sess_save_path设置为该名称: $ config ['sess_save_path'] =ci_sessions


  4. 如果您使用的是Unix / Linux,请务必使用大写字母加载库: $ autoload ['libraries'] = array ('Session');

  5. 如果无效,请检查您是否从 http://www.codeigniter.com/download



Trying to load Session library in Codeigniter. It seems to be clearly right but actully don't work. Here's a part of config file:

$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;

As well, ncryption key variable has already set. Moreover, CI 3 documentation can't give me the way to solve this problem.


I've tried to:

  1. Set 'sess_save_path' variable to 'ci_sessions'
  2. Check folders permissions
  3. Check if table 'ci_sessions' exists
  4. Use Autoloader class
  5. Use class name with capital S


It's strange a little, but config says:

 /*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/www folder
| or in your application/www folder.
|
| Prototype:
|
|   $autoload['www'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
|   $autoload['www'] = array('user_agent' => 'ua');
*/

And here's a code of autoloader:

// Load www
        if (isset($autoload['www']) && count($autoload['www']) > 0)
        {
            // Load the database driver.
            if (in_array('database', $autoload['www']))
            {
                $this->database();
                $autoload['www'] = array_diff($autoload['www'], array('database'));
            }

            // Load all other www
            foreach ($autoload['www'] as $item)
            {
                $this->library($item);
            }
        }

解决方案

Here's a list of what you should try:

  1. Make sure you load the session library in autload.php: $autoload['libraries'] = array('session');

  2. Make sure your encryption key is set in cofing.php: $config['encryption_key'] = 'anything_here'

  3. Make sure your database table is named ci_sessions and your sess_save_path is set to that name: $config['sess_save_path'] = "ci_sessions"

  4. If you are on Unix/Linux, make sure to load your library with capital letters: $autoload['libraries'] = array('Session');

  5. If nothing works, check that you download and install the right CI3 files from http://www.codeigniter.com/download

这篇关于无法加载请求的类:Session Codeigniter 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆