CodeIgniter Forums

Full Version: Issue with cookie not setting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good day all, I followed the instruction in the documentation ot setting cookie, it does not work.

After checking through the cookie code, I discovered issue 1 that the sendcookie method is sent after the body is returned. Which makes the method inaccessible. 2 even when the sendcookie method is brought forward, and is accessible, the content of the 
Cookies array is empty.
Providing example code is always good. Setting it on the response should be all that's needed:

Code:
$this->response->setCookie()
CodeIgniter 4 rc.1 does not send cookies where controller response is redirect?

PS: Sorry, I do not have a full test, but I have a user authentication component where only native PHP method setcookie() is working.
https://github.com/denis303/codeigniter4...ervice.php