php - losing cookie after closing the browser -
$value = array( 'id' => $data['id'] , 'username' => $data['username'] , 'email' => $data['email'] , 'last_ip' => $this->input->ip_address() ); $value = serialize($value); $cookie = array ( 'name' => 'is_logged' , 'value' => $value , 'expire' => time()+86400 , ); set_cookie($cookie); i have function checking cookie
function get_k(){ $k = get_cookie('is_logged'); var_dump($k); } this works fine after login while browser still open , if close browser , doesn't work anymore
my config
$config['cookie_prefix'] = ""; $config['cookie_domain'] = ""; $config['cookie_path'] = "/"; $config['cookie_secure'] = false; i'm working on localhost/firefox
remove time() 'expire' value, codeigniter adds automatically.
you have stray comma after 'expire'.
Comments
Post a Comment