English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The setrawcookie() function sends an unencoded cookie.
bool setrawcookie(string $name[, string $value[, int $expire = 0[, string $path[, string $domain[, bool $secure = false[, bool $httponly = false]]]]]])
Definition and Usage
Return Value
Parameter | Serial Number |
---|---|
1 | Parameters and Descriptions name |
2 | Cookie's Name. This is the name of the parameter. It is used to identify the cookie in the $_COOKIE array. value |
3 | Cookie Value. This value is stored on the user's computer, do not store sensitive information. For example, if the name is 'cookiename', its value can be obtained through $_COOKIE['cookiename']. errno |
4 | It contains information about the cookie input. expire 197Cookie's Expiration Time. This is a Unix timestamp, which is the number of seconds since the Unix epoch (Greenwich Mean Time 1 0 Year 1 Month+60*60*24*3days at 00:00:00) in seconds. That is, you can use the result of the time() function plus the number of seconds you want the Cookie to expire. Or you can also use mktime(). time() 30 is to set Cookie |
5 | 0 days later expire. If set to zero, or omitted, the Cookie will expire at the end of the session (i.e., when the browser is closed). path/Cookie's Valid Server Path. Set to '/foo/when the Cookie is only valid for the domain in 'domain', the Cookie is valid for the entire domain 'domain'. If set to ' /foo/ Directory and its subdirectories are valid (for example /foo/bar/). The default value is the current directory at the time the Cookie is set. |
6 | domain Cookie's Valid Domain/Subdomain. Setting it to a subdomain (e.g., 'www.example.com') makes the Cookie valid for this subdomain and its third-level domains (e.g., w2.www.example.com). To make the Cookie valid for the entire domain (including all its subdomains), just set it to the domain (in this example, 'example.com'). |
Try the following examples
<?php setrawcookie('cookie_name', rawurlencode($value), time())+60*60*24*365); ?>