slj_zone 发表于 2015-10-12 17:07:43

session加载错误

控制器代码:                $this->load->library('session');
                $user=array('id'=>3,'name'=>'jack');
                $this->session->set_userdata('user',$user);
结果发生错误

A PHP Error was encounteredSeverity: Warning
Message: 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: libraryFile: 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: libraryFile: E:\amp\apache\htdocs\mvc\index.php
Line: 292
Function: require_once

smartweb 发表于 2015-10-12 20:00:02

$config['sess_save_path'] =BASEPATH.'../'.'session_file';

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

一叶扁舟 发表于 2015-10-12 18:47:03

Configured save path '' is not a directory, doesn't exist or cannot be created.
路径有误,config中没配置默认会使用php.ini中的配置

smartweb 发表于 2015-10-12 19:14:41

application/config/config.php
在大概行257左右加入$config['sess_save_path'] ='tmp';
我试过改tmp为其它值不行,只有这样才行,仅供参考

slj_zone 发表于 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文 ...

万分感谢!
纠结了一下午了快

hbualong 发表于 2016-8-11 15:07:27

smartweb 发表于 2015-10-12 19:14
application/config/config.php
在大概行257左右加入$config['sess_save_path'] ='tmp';
我试过改tmp为其它 ...

我试了一下不行?

dayrui 发表于 2016-8-12 08:27:55


config.php 配置好路径

been 发表于 2016-9-29 20:26:08

smartweb 发表于 2015-10-12 20:00
$config['sess_save_path'] =BASEPATH.'../'.'session_file';

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

此法经验证,可行。

been 发表于 2016-9-29 20:26:19

smartweb 发表于 2015-10-12 20:00
$config['sess_save_path'] =BASEPATH.'../'.'session_file';

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

此法经验证,可行。{:1_1:}
页: [1] 2
查看完整版本: session加载错误