开发者

cookie_secure=TRUE and problem in userdata

开发者 https://www.devze.com 2023-03-25 04:00 出处:网络
why in codeigniter when that $config[\'cookie_secure\'] is TRUE, no开发者_Python百科t work $this->session->userdata() and return is false?

why in codeigniter when that $config['cookie_secure'] is TRUE, no开发者_Python百科t work $this->session->userdata() and return is false?

what di i do?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号