用户
 找回密码
 入住 CI 中国社区
搜索
查看: 11328|回复: 12
收起左侧

[版本 3.x] session加载错误

[复制链接]
发表于 2015-10-12 17:07:43 | 显示全部楼层 |阅读模式
控制器代码:                $this->load->library('session');
                $user=array('id'=>3,'name'=>'jack');
                $this->session->set_userdata('user',$user);
结果发生错误

A PHP Error was encounteredSeverity: Warning
Message: mkdir() [function.mkdir]: Invalid argument
Filename: drivers/Session_files_driver.php
Line Number: 117
Backtrace:
File: E:\amp\apache\htdocs\mvc\application\controllers\user.php
Line: 75
Function: library
File: E:\amp\apache\htdocs\mvc\index.php
Line: 292
Function: require_once

An uncaught Exception was encounteredType: Exception
Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.
Filename: E:\amp\apache\htdocs\mvc\system\libraries\Session\drivers\Session_files_driver.php
Line Number: 119
Backtrace:
File: E:\amp\apache\htdocs\mvc\application\controllers\user.php
Line: 75
Function: library
File: E:\amp\apache\htdocs\mvc\index.php
Line: 292
Function: require_once

发表于 2015-10-12 20:00:02 | 显示全部楼层
$config['sess_save_path'] =BASEPATH.'../'.'session_file';

session文件夹存在根目录下,session_file文件夹会自动建立,收工

点评

此法经验证,可行。2016年9月29日20:25:32  发表于 2016-9-29 20:25
此法经验证,可行。  发表于 2016-9-29 20:25
发表于 2015-10-12 18:47:03 | 显示全部楼层
Configured save path '' is not a directory, doesn't exist or cannot be created.
路径有误,config中没配置默认会使用php.ini中的配置
发表于 2015-10-12 19:14:41 | 显示全部楼层
application/config/config.php
在大概行257左右加入$config['sess_save_path'] ='tmp';
我试过改tmp为其它值不行,只有这样才行,仅供参考
 楼主| 发表于 2015-10-13 09:53:42 | 显示全部楼层
谢谢大神们
发表于 2016-4-26 16:38:45 | 显示全部楼层
smartweb 发表于 2015-10-12 20:00
$config['sess_save_path'] =BASEPATH.'../'.'session_file';

session文件夹存在根目录下,session_file文 ...

万分感谢!
纠结了一下午了快
发表于 2016-8-11 15:07:27 | 显示全部楼层
smartweb 发表于 2015-10-12 19:14
application/config/config.php
在大概行257左右加入$config['sess_save_path'] ='tmp';
我试过改tmp为其它 ...

我试了一下不行?
发表于 2016-8-12 08:27:55 | 显示全部楼层

config.php 配置好路径

发表于 2016-9-29 20:26:08 | 显示全部楼层
smartweb 发表于 2015-10-12 20:00
$config['sess_save_path'] =BASEPATH.'../'.'session_file';

session文件夹存在根目录下,session_file文 ...

此法经验证,可行。
发表于 2016-9-29 20:26:19 | 显示全部楼层
smartweb 发表于 2015-10-12 20:00
$config['sess_save_path'] =BASEPATH.'../'.'session_file';

session文件夹存在根目录下,session_file文 ...

此法经验证,可行。

本版积分规则