Cookie Helper¶
The Cookie Helper file contains functions that assist in working with cookies.
Page Contents
Loading this Helper¶
This helper is loaded using the following code
$this->load->helper('cookie');
The following functions are available:
set_cookie()¶
This helper function gives you view file friendly syntax to set browser cookies. Refer to the Input class for a description of use, as this function is an alias to $this->input->set_cookie().
Parametreler: - $name (string) – the name of the cookie
- $value (string) – the value of the cookie
- $expire (string) – the number of seconds until expiration
- $domain (string) – the cookie domain. Usually: .yourdomain.com
- $path (string) – the cookie path
- $prefix (string) – the cookie prefix
- $secure (boolean) – secure cookie or not.
Dönüş değeri:: void
get_cookie()¶
This helper function gives you view file friendly syntax to get browser cookies. Refer to the Input class for a description of use, as this function is an alias to $this->input->cookie().
Parametreler: - $index (string) – the name of the cookie
- $xss_clean (boolean) – If the resulting value should be xss_cleaned or not
Dönüş değeri:: mixed
delete_cookie()¶
Lets you delete a cookie. Unless you’ve set a custom path or other values, only the name of the cookie is needed
Parametreler: - $name (string) – the name of the cookie
- $domain (string) – cookie domain (ususally .example.com)
- $path (string) – cookie path
- $prefix (string) – cookie prefix
Dönüş değeri:: void
delete_cookie("name");
This function is otherwise identical to set_cookie(), except that it does not have the value and expiration parameters. You can submit an array of values in the first parameter or you can set discrete parameters.
delete_cookie($name, $domain, $path, $prefix)
