How to set and get cookies in code igniter

$cookie_name = "sendsmsalert2"; $cookie_value = "send done"; setcookie($cookie_name, $cookie_value, time() + (86400), "/"); function get() { $cookie_name = "sendsmsalert"; if (!isset($_COOKIE[$cookie_name])) { echo "Cookie named "" . $cookie_name . "" is not set!"; } else { echo "Cookie "" . $cookie_name . "" is set!<br>"; echo "Value is: " . $_COOKIE[$cookie_name]; } }
Deepak Sharma
Asked 11-11-2019
32

Answer (1)
                        $cookie_name = "UserDetails";                         $cookie_value = json_encode($sessionData);                         setcookie($cookie_name, $cookie_value, time() + (86400) * (30 * 365), "/"); 
Deepak Sharma
Asked 28-09-2019
45 Likes
Comments
Write comment

Submit your answer