Tutorialsplane

Cookie Helper


Codeigniter Cookie Helper contains the functions that are used in working with cookies. Here in this tutorial we are going to explain how you can create cookies using this helper. Let us go step by step to learn about the Cookie Helper.


Cookie Helper in Codeigniter Example

Load This Helper

Before using the helper function you must load this helper as below –

Cookie Helper in Codeigniter Example:

$this->load->helper('cookie');

After Loading this function you can use it’s functions.

Cookie Helper Functions

Let us go through the available functions in this helper.

set_cookie Function

Syntax of set_cookie function

Codeigniter set_cookie function syntax:

set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE);

Parameters:

get_cookie Function

Syntax of get_cookie function

Codeigniter get_cookie function syntax:

get_cookie($index, $xss_clean = NULL);

Parameters:

Returns:

Returns cookie value. If value not found it will return NULL.

delete_cookie Function

Syntax of delete_cookie function

Codeigniter delete_cookie function syntax:

delete_cookie($index, $domain, $path, $prefix);

Parameters:

Models

Connect Database

Helpers

Libraries

Helper Reference

Library Reference

Database Reference