无法加载请求的类:Session Codeigniter 3 [英] Unable to load the requested class: 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>
- 将'sess_save_path'变量设为'ci_sessions'
- 检查文件夹权限
- 检查表'ci_sessions'是否存在
- 使用Autoloader类
- 使用具有大写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);
}
}
您应该尝试的列表:
-
确保您在autload.php中加载会话库:
$ autoload ['libraries'] = array('session');
-
确保您的加密密钥设置为cofing .php:
$ config ['encryption_key'] ='anything_here'
-
被命名为
ci_sessions
,并且您的sess_save_path设置为该名称:$ config ['sess_save_path'] =ci_sessions
-
如果您使用的是Unix / Linux,请务必使用大写字母加载库:
$ autoload ['libraries'] = array ('Session');
如果无效,请检查您是否从 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:
- Set 'sess_save_path' variable to 'ci_sessions'
- Check folders permissions
- Check if table 'ci_sessions' exists
- Use Autoloader class
- 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:
Make sure you load the session library in autload.php:
$autoload['libraries'] = array('session');
Make sure your encryption key is set in cofing.php:
$config['encryption_key'] = 'anything_here'
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"
If you are on Unix/Linux, make sure to load your library with capital letters:
$autoload['libraries'] = array('Session');
If nothing works, check that you download and install the right CI3 files from http://www.codeigniter.com/download
这篇关于无法加载请求的类:Session Codeigniter 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!