Codeigniter cookies not set?

After a short attempt to get the cookie set with codeigniter, I did this simple test to make sure they work. I read the CI documentation about cookies and found that this is not enough. Someone please tell me what happened?

 $this->input->set_cookie('test', 'testing a lot');

 echo $this->input->cookie('test');

Yes, I am loading a cookie helper.

+3
source share
1 answer

You don’t need to download the cookie helper unless you intend to use the shortcut function alias.

Check your cookie settings in config.php. Special:

$config['cookie_path'] = "/";

If that doesn't work, just use the PHP built-in function to set cookies, and you can probably still use the CI () input to get them.

setcookie("name", $value);
+3
source

All Articles