The Cookie Helper file contains functions that assist in working with cookies.
This helper is loaded using the following code:
$this->load->helper('cookie');
The following functions are available:
Parameters: |
|
---|---|
Return type: |
void |
This helper function gives you friendlier syntax to set browser cookies. Refer to the Input Library for a description of its use, as this function is an alias for CI_Input::set_cookie()
.
Parameters: |
|
---|---|
Returns: |
The cookie value or NULL if not found |
Return type: |
mixed |
This helper function gives you friendlier syntax to get browser cookies. Refer to the Input Library for detailed description of its use, as this function acts very similarly to CI_Input::cookie()
, except it will also prepend the $config['cookie_prefix']
that you might’ve set in your application/config/config.php file.
Parameters: |
|
---|---|
Return type: |
void |
Lets you delete a cookie. Unless you’ve set a custom path or other values, only the name of the cookie is needed.
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);
© 2014–2016 British Columbia Institute of Technology
Licensed under the MIT License.
https://www.codeigniter.com/user_guide/helpers/cookie_helper.html