Jan 20, 2020 C is for Cookies and Consent In this article, we’ll continue to look at the (in-progress) NetLearner application, which was generated using multiple ASP.NET Core web app project (3.1) templates. In previous releases, the template made it very easy for you to store cookies and display a cookie policy. Download the code or configure your cookie consent popup with just a few clicks and in less than 5 minutes.
The Cookie Helper file contains functions that assist in working withcookies.
This helper is loaded using the following code:
The following functions are available:
Cookie 18
set_cookie
($name[, $value = '[, $expire = '[, $domain = '[, $path = '/'[, $prefix = '[, $secure = NULL[, $httponly = NULL]]]]]]])¶Parameters: |
|
---|---|
Return type: | void |
This helper function gives you friendlier syntax to set browsercookies. Refer to the Input Library fora description of its use, as this function is an alias forCI_Input::set_cookie()
.
get_cookie
($index[, $xss_clean = NULL])¶Parameters: |
|
---|---|
Returns: | The cookie value or NULL if not found |
Return type: | mixed |
Food52
This helper function gives you friendlier syntax to get browsercookies. Refer to the Input Library fordetailed description of its use, as this function acts verysimilarly to CI_Input::cookie()
, except it will also prependthe $config['cookie_prefix']
that you might’ve set in yourapplication/config/config.php file.
delete_cookie
($name[, $domain = '[, $path = '/'[, $prefix = ']]])¶Cookietins.com
Parameters: |
|
---|---|
Return type: | void |
RFC 6265: HTTP State Management Mechanism
Lets you delete a cookie. Unless you’ve set a custom path or othervalues, only the name of the cookie is needed.
This function is otherwise identical to set_cookie()
, except that itdoes not have the value and expiration parameters. You can submit anarray of values in the first parameter or you can set discreteparameters.