Welcome Guest, Not a member yet? Register   Sign In
cookies and CI4
#1

Hi guys, 

I am having a really hard time setting a cookie in CI4, And i have no idea how to diagnose this.

I have followed the information https://codeigniter.com/user_guide/helpe...elper.html and wrote a set cookie.

$expires  = date('Y-m-d H:iConfused', time() + 1000);
set_cookie([
    'name' => 'auth_cookie_id',
    'value' => 'value_of_cookie',
    'expire' => $expires,
    'httponly' => false
]);


My problem is this cookie never generates. Im using localhost and its either the php environment (in windows) or the default config settings for cookies (or the .env file). As there is no information on this for CI4 and I have never worked with cookies before I have little knowledge to draw from to try and resolve this problem.

I have googled loads, and found tones of information, none of which seemed to help generate a cookie for me.

What i would like to ask is if someone could provide a working example using localhost for CI4 so i can look at it and see whats different for me.

How you set the cookie (I assume in the controller), how it gets to the user (returning back from contropller sends the cookie on $response??)
How to check the cookie got to the user - Currently im using google chrome pressing F12 and checking the Cookies section (i can see the ci_session cookie and the debugbar cookies fine)

Is there anything i would need to enable in the php.ini file for this too? I have not used XAMMP, but pure php install and modifying the ini as I go for the bits i need (turning on curl, email support etc)

Sorry to ask this here, Its just i simply cannot find any good resource for this problem.
Reply


Messages In This Thread
cookies and CI4 - by kristianlake - 07-14-2020, 06:19 AM
RE: cookies and CI4 - by kristianlake - 07-14-2020, 10:21 AM
RE: cookies and CI4 - by jreklund - 07-14-2020, 12:12 PM
RE: cookies and CI4 - by kristianlake - 07-14-2020, 01:06 PM
RE: cookies and CI4 - by GeorgeBunzi - 12-22-2021, 09:22 PM
RE: cookies and CI4 - by kenjis - 12-22-2021, 11:16 PM
RE: cookies and CI4 - by paulbalandan - 12-22-2021, 11:37 PM
RE: cookies and CI4 - by InsiteFX - 12-23-2021, 02:18 AM
RE: cookies and CI4 - by kenjis - 12-23-2021, 03:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB