codeigniter会话加载错误:没有这样的文件或目录

时间:2016-10-08 08:02:31

标签: codeigniter

我正在关注此tutorial

然而,当我访问

http://localhost/index.php/user_authentication/

我得到了这个警告,无法运行代码:

Warning: include(C:\xampp\htdocs\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\xampp\htdocs\system\core\Exceptions.php on line 269

Warning: include(): Failed opening 'C:\xampp\htdocs\application\views\errors\html\error_php.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\system\core\Exceptions.php on line 269

Warning: include(C:\xampp\htdocs\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\xampp\htdocs\system\core\Exceptions.php on line 269

Warning: include(): Failed opening 'C:\xampp\htdocs\application\views\errors\html\error_php.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\system\core\Exceptions.php on line 269

当我删除$this->load->library('session');

警告消失了,所以我很确定加载会话库时出错了。

我已经读过通过更改$ config ['sess_save_path'] = sys_get_temp_dir();

来修复问题

但我仍然收到警告。

我甚至尝试将此代码添加到我的控制器: mkdir(“/ thisisthedirectory”,0700);

然后改变了我的$ config ['sess_save_path'] =“/ thisisthedirectory”;但它不起作用

nor $ config ['sess_save_path'] =“C:\ thisisthedirectory”;

有人能告诉我如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

确保您已将会话保存路径设置为

$config['sess_save_path'] = APPPATH . 'cache/';
  

文件夹权限0700

的config.php

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = APPPATH . 'cache/';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;

注意:请确保您已遵循File NamingClass Naming

的Codeigniter样式指南