CI4 Helper Function set_cookie doesn't create a cookie on browser |
CI4 Helper Function set_cookie doesn't create a cookie on browser
Hello Everyone, I am working on Codeigniter v4.1.2. I created a login page, and was trying to create a cookie using a Helper function set_cookie . Code: set_cookie("cookie_name","cookie_value","cookie_expiry") Inside Cookie Helper Code PROJECT_PATH/vendor/codeigniter4/framework/system/Helpers/cookie_helper.php The set_cookie function calls the Service Response Code: setCookie In the Service Response setCookie Method, it calls the put method in PROJECT_PATH/vendor/codeigniter4/framework/system/Cookie/CookieStore.php Code: $this->cookieStore = $this->cookieStore->put($cookie); Code: public function put(Cookie $cookie) The put method, just creates a clone of the class and assigns the sets the new cookie. However, it doesn't create any cookie on browser and returns the class object. I added the Line Code: $store->dispatch(); Code to Create a cookie on browser is written in dispatch() function. Code: public function put(Cookie $cookie) I think many people would be facing this issue. As I found similar issue posted on Stackoverflow https://stackoverflow.com/questions/6677...ot-setting , 2 months back. Can someone help with this? Thank you. |
Messages In This Thread |
CI4 Helper Function set_cookie doesn't create a cookie on browser - by vtankaria - 06-04-2021, 02:42 AM
RE: CI4 Helper Function set_cookie doesn't create a cookie on browser - by includebeer - 06-09-2021, 04:56 PM
RE: CI4 Helper Function set_cookie doesn't create a cookie on browser - by paliz - 06-09-2021, 10:43 PM
RE: CI4 Helper Function set_cookie doesn't create a cookie on browser - by zeeforum - 06-21-2021, 03:47 AM
|