/* First load cookie helper */ $this->load->helper('cookie'); //Otherwise you can add this helper in the config/autoload.php /* Set cookie */ $cookie= array('name'=>"your_data", 'value'=>$uniq_cookie_id, 'expire'=>"3600"); $this->input->set_cookie($cookie); OR set_cookie($cookie); /* Get cookie */ $exist_cookie_data = get_cookie('your_data'); /* Check if cookie data is exist */ if($this->input->cookie('your_data')!=''){ //Write your code here if cookie exist }
Question and answer is powered by AnsPress.io