If you set a cookie, then redirect to another page, the cookie does not get set. This used to work in codeigniter 3.
PHP Code:
helper( 'cookie' );
set_cookie( 'my_new_cookie', 'this is some cookie text', 60 * 60 * 24 * 7 );
$redirect = redirect();
$redirect->to( '/cookie_check' );
return $redirect;
If you set the cookie without the redirect, it works.
PHP Code:
helper( 'cookie' );
set_cookie( 'my_new_cookie', 'this is some cookie text', 60 * 60 * 24 * 7 );
Also, if you use the built in php setcookie function, it works as expected
PHP Code:
setcookie( 'my_new_cookie', 'this is some cookie text', time() + 60 * 60 * 24 * 7, '/');
$redirect = redirect();
$redirect->to( '/cookie_check' );
return $redirect;