cookie_secure=TRUE and problem in userdata
why in codeigniter when that $config['cookie_secure']
is TRUE
, no开发者_Python百科t work $this->session->userdata()
and return is false?
application\config\config.php:
$config['cookie_secure'] = TRUE;
$newdata = array(
'user' => $this->input->post('useradmin'),
'logged_in' => TRUE
);
$this->session->set_userdata($newdata);
////////////////////// in following code return is false if $config['cookie_secure'] = TRUE; //////////////////////////////////
function foreign_tourt(){
if($this->session->userdata('logged_in')) {
$this->load->view('admin/foreign_tour');
}else{
return false;
}
}
As it is said in the config.php file itself:
//|' cookie_secure' = Cookies will only be set if a secure HTTPS connection exists
If your website is not on HTTPS, cookies will not be sent. Set is as
$config['cookie_secure'] = FALSE;
in config.php and everything will work again
精彩评论