[未解决]CodeIgniter调用session出错
2015-10-26 00:11
387 查看
A PHP Error was encountered Severity: Warning Message: mkdir(): Invalid path Filename: drivers/Session_files_driver.php Line Number: 117 Backtrace: File: /Users/Elsa/Sites/application/controllers/Login.php Line: 22 Function: __construct File: /Users/Elsa/Sites/index.php Line: 292 Function: require_once
An uncaught Exception was encountered Type: Exception Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created. Filename: /Users/Elsa/Sites/system/libraries/Session/drivers/Session_files_driver.php Line Number: 119 Backtrace: File: /Users/Elsa/Sites/application/controllers/Login.php Line: 22 Function: __construct File: /Users/Elsa/Sites/index.php Line: 292 Function: require_once
在使用ci做项目的时候,发现了以上两条错误信息。
查找了一下网上的资料:
http://www.zhangty.cn/archives/53
http://stackoverflow.com/questions/29431910/codeigniter-cannot-load-libraries
说是在config.php里面:
$config['sess_driver'] = 'files'; $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; $config['sess_regenerate_destroy'] = FALSE;
因为这一条
$config['sess_save_path'] = NULL;
的session储存的地址被定义为NULL。正确的做法应该是给他写一个存储的路径。建议是用tmp文档,会清空暂存的session。
然而我新建了一个folder名叫session_repository,然后把我的路径指定为(我的操作系统是mac):
$config['sess_save_path'] = '/Users/xxxx/Sites/session_repository';
于是这个问题就解决了,不过跳转到下一个问题:
Unable to locate the specified class: Session.php
然而我按照网上的资料,把autoload.php里面的内容改成如下也无法解决:
$autoload['drivers'] = array('session');
未完待续……
相关文章推荐
- 信息与随机性洗牌作业
- 软件工程——第六次作业——团队作业
- andrid中的Sqlite 数据库连接(本地版)
- 快慢指针
- zufe 1932: 语音识别 (模拟_有点烦)
- Xcode7 ios9 集成 融云
- php 显示sqlserver二进制图片
- Effective Objective-C 2.0 第10条:在既有类中使用关联对象存放自定义数据
- 深入解读缓存(二)——一致性Hash算法
- C语言for循环之等边倒三角的打印
- 进程线程及堆栈关系的总结
- 图像二值化概述
- hdu 2612 Find a way(BFS)
- node.js
- 每日安全资讯:BGP 路由表即将突破 768k,可能会引发网络故障
- JSP中response.setContentType和response.setCharacterEncoding区别分析
- JSP页面中超链接传递中文参数出现乱码问题解决方法
- C#正则表达式之Regex类用法详解
- C#正则表达式判断输入日期格式是否正确
- ASP.NET MVC 3仿Server.Transfer效果的实现方法