Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 set_cookie Helper is not working
#1
Question 

I have found this problem while working with cookies. A little bit information how problem occurs, please read carefully.

I'm using cookie helper. When I tried to create cookie in controller method it's working fine (No Problem).
But When I generated my own helper their I tried to set cookie using cookie helper, it's not generating cookie in the browser.

That's the issue with Codeigniter 4 Cookie Helper/Library.
Reply
#2

(This post was last modified: 06-21-2021, 07:25 AM by ikesela.)

(06-21-2021, 12:19 AM)zeeforum Wrote: I have found this problem while working with cookies. A little bit information how problem occurs, please read carefully.

I'm using cookie helper. When I tried to create cookie in controller method it's working fine (No Problem).
But When I generated my own helper their I tried to set cookie using cookie helper, it's not generating cookie in the browser.

That's the issue with Codeigniter 4 Cookie Helper/Library.

try check browser console for errors. modern browser require to set to true in config/App.php:
$cookieSecure = true;
Reply
#3

In your helper did you add these to the top of it just before the first function/method?
PHP Code:
use Config\App;
use 
codeigniter\Config\Services
Those are the only two things that would stop it from working.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

Issue resolved, I have too redirect page withCookies.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB