Delete phpcookies and assign values. Delete cookies in the php Tutorial. The value assignment method cookie is often used to identify users. Cookie is a small file that the server stays on the user's computer. Every time the same computer requests a page through a browser, the php Tutorial deletes cookies and assigns values.
Cookies are often used to identify users. Cookie is a small file that the server stays on the user's computer. When the same computer requests a page through a browser, it sends a cookie at the same time. With php, you can create and retrieve cookie values
Syntax
Setcookie (name, value, expire, path, domain );
**
* Set cookie
* N name
* C value
* E validity period 0: one month by default; 1: disabled; expired immediately
*/
Function w_cookie ($ n, $ c, $ e = 0, $ isdes = 1)
{
If ($ isdes = 1) {$ c = endes ($ c, Region EY );}
$ Exp = time () + 3600*24*30;
If ($ e = 0)
{
Setcookie ($ n, $ c, $ exp ,"/");
}
Else
{
Setcookie ($ n, $ c, 0 ,"/");
}
}
// Method for disabling cookies
W_cookie ('BB ', 'www. bKjia. c0m', $ e = 0, $ isdes = 1 );
For more details, see http://www.bKjia. c0m/phper/php/34040.htm
More detailed method
Function set_cronology ($ name, $ value, $ duration = 7 ){
$ Duration = time () + (3600*24 * $ duration );
$ Max_stored_values = 5;
If (isset ($ _ cookie [$ name]) {
Foreach ($ _ cookie [$ name] as $ prop_crono => $ val_crono ){
If ($ val_crono = $ value)
Return;
}
If ($ prop_crono <$ max_stored_values)
Setcookie ($ name. '['. ($ prop_crono + 1). ']', $ value, $ duration );
Else {
Array_shift ($ _ cookie [$ name]);
Setcookie ("$ name [$ max_stored_values]", $ value, $ duration );
}
} Else
Setcookie ($ name. '[0]', $ value, $ duration );
Return;
}
?>
Note: The setcookie () function must be locatedBefore the tag. When sending a cookie, the cookie value is automatically url encoded and automatically decoded when Retrieved. to prevent url encoding, use setrawcookie () instead ).
Cookies are deleted. value assignment: cookies are often used to identify users. Cookie is a small file that the server stays on the user's computer. When the same computer requests a page through a browser...