Posted inCodeigniter / php

How to set (Create), Access and Delete Cookies in codeigniter ?

I can easy way to Set, Get and Delete Cookies with PHP CodeIgniter using Cookie Helper, Cookie Helper data contains functions that assist in working with very well cookies set get and unset.

How to Set, Get and Delete Cookies in CodeIgniter?

Before using Cookie Helper functions you Should load cookie Helper, in the bellow methods :


The bellow functions are available with Cookie Helper methods: set_cookie(), get_cookie() and delete_cookie()

Also Read: Session Management in CodeIgniter with PHP

IMP Note :

  • set_cookie() is alias to $this->input->set_cookie()
  • get_cookie() is alias to $this->input->cookie();

set cookie expire time in codeigniter

set cookie

$cookieInfoData = array(
		'name'   => 'home_set',
		'value'  => 'Welcome To Pakainfo Website',
		'expire' => time()+86500,
		'domain' => '.localhost',
		'path'   => '/',
		'prefix' => 'pakainfo_',


how to get array in cookie

get cookie


unset cookie in codeigniter

delete cookie

$cookieInfoData = array(
    'name'   => 'home_set',
    'value'  => '',
    'expire' => '0',
    'domain' => '.localhost',
    'prefix' => 'pakainfo_'

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype