CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);
这是我控制器中的代码
$data=array(
'username'=>$this->input->post('username'),
'is_logged_in'=> true
);
$this->session->set_userdata($data);
这里是config.php
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_encrypt_cookie'] = 'TRUE';
$config['sess_use_database'] = 'TRUE';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_match_useragent'] = 'TRUE';
但是当我登录时,数据没有存储在数据库中,代码有什么问题?谢谢你的支持!!!!
答案 0 :(得分:1)
在config.php中更改此行
$config['sess_driver'] = 'files';
到这个
$config['sess_driver'] = 'database';
答案 1 :(得分:0)
更改您的config.php
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
我希望这可以帮助你...