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

(This post was last modified: 07-14-2020, 10:53 AM by kristianlake.)

Okay so i have made some progress.

helper('cookie');

            setcookie('user2', 'value2', time() + 6000, '/', '');   <--- works!

            set_cookie([
                'name' => 'auth_cookie_id',
                'value' => 'value_of_cookie',
                'expire' => time() + 6000,
                'path' => '/',
                'domain' => ''
            ]);

The first setcookie actually works.

I will keep going on this, but hoping someone can help me out Smile

Finally figured it out.

in my controller i was calling

public function myFunction()
{
//works but is PHP
setcookie('user2', 'value2', time() + 6000, '/', '');

//this did not work, never returned anything back.
set_cookie([
'name' => 'user3',
'value' => 'value3',
'expire' => time() + 6000
]);

//this worked, not sure if this is the best way though
return $this->myFunctionOK($user)->setCookie([
'name' => 'user4',
'value' => 'value4',
'expire' => time() + 6000
]);
}

So my real question is on user3, did i need to do something to make it send back? or did i need to return it as part of myFunctionOK.

Attached Files Thumbnail(s)
   
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