Cookies are widely used in PHP programming, there are three ways to use cookies in this codeigniter, and readers can use them according to their own project requirements.
The first way: the value of cookies that are set by using the native PHP method
Setcookie ("user_id", $user _info[' user_id '],86500);
Setcookie ("username", $user _info[' username '],86500);
Setcookie ("Password", $user _info[' password '],86500);
echo$_cookie[' username '];
The second way: Set the value of the cookie through the CI framework's input class library
$this->input->set_cookie ("username", $user _info[' username '],60);
$this->input->set_cookie ("password", $user _info[' password '],60);
$this->input->set_cookie ("user_id", $user _info[' user_id '],60);
Echo$this->input->cookie ("password");//Applicable to Controller
//echo$this->input->cookie ("username"); Applicable to controller
//echo$_cookie[' username '];//can get COOKIE values in this way in the model class
//echo$_cookie[' password '];// You can get cookie values in this way in the model class
A third way: To set the value of a cookie through the cookie_helper.php auxiliary function Library of the CI framework
Set_cookie ("username", $user _info[' username '],60);
Set_cookie ("Password", $user _info[' password '],60);
Set_cookie ("user_id", $user _info[' user_id '],60);
Echoget_cookie ("username");