The cookie function is also a multiplication function that completes the cookie setup, fetch, and delete operations.
Cookies are used to http://www.aliyun.com/zixun/aggregation/12583.html ">cookie settings, FETCH, delete operations use cookies ($name, $value = ', $option = NULL) parameter name (required): Cookie variable to manipulate
Value (optional): The cookie value to set
Option (optional): Incoming cookie setting parameters, default null return value See details (return different values according to the specific usage)
Cookie settings
Cookie (' name ', ' value '); Set Cookiecookie (' name ', ' value ', 3600); Specify Cookie Save time
Starting with version 3.1, the cookie method adds support for the array (using a lightweight JSON encoding format to save storage space), for example:
Cookies (' name ', Array (' name1 ', ' name2 '));
You can also support the way parameters are passed in to complete a complex cookie assignment, the following is a 3,600-second validity period for the cookie value, plus a cookie prefix THINK_
Cookies (' name ', ' value ', Array (' Expire ' =>3600, ' prefix ' => ' think_ '))
Array parameters can take the form of query argument
Cookie (' name ', ' value ', ' expire=3600&prefix=think_ ')
is equivalent to the above usage.
The option parameter passed in supports Prefix,expire,path,domain four index parameters, and Cookie_prefix, Cookie_expire, Cookie_path, and cookies are taken by default if there are no incoming or incoming null values _domain four configuration parameters. If only the individual parameters are passed in, they are also merged with the default configuration parameters.
Cookies get
Getting cookies is very simple, regardless of how the cookie is set up, you only need to use:
$value = Cookie (' name ');
If the cookie prefix is not set, the equivalent
$value = $_cookie[' name ']
If the cookie prefix is set, the equivalent
$value = $_cookie[' prefix +name ']
Cookie deletion
Deletes the value of a cookie by using:
Cookie (' name ', null);
To remove all cookie values, you can use the
Cookie (NULL); Clears all cookie value cookies (null, ' THINK_ ') for the current prefix; Empty all cookie values for the specified prefix