php - CodeIgniter cookie setter issue -
the following doesn't set cookie in codeigniter.
$this->load->helper('cookie'); if (!$this->input->cookie('xx')) { //cookie not set, first visit $cookie = array( 'name' => 'xx', 'value' => '1', 'expire' => (10 * 365 * 24 * 60 * 60), 'path' => '/', 'prefix' => '', 'secure' => true ); $this->input->set_cookie($cookie); }
checked browser , used vardump($this->input->cookie('xx')); result false.
try removing secure array
$this->load->helper('cookie'); if (!$this->input->cookie('xx')) { //cookie not set, first visit $cookie = array( 'name' => 'xx', 'value' => '1', 'expire' => (10 * 365 * 24 * 60 * 60), 'path' => '/', 'prefix' => '' ); $this->input->set_cookie($cookie); } // may work
Comments
Post a Comment