Fortunecookie general assignment methods that are removed from PHP cookies

Source: Internet
Author: User
Tags set cookie setcookie
The general assignment method cookie that is removed in PHP cookies is often used to identify users. A cookie is a small file that the server leaves on the user's computer. Whenever the same computer requests a page through a browser, it also sends a cookie. With PHP, you can create and retrieve the value of a cookie
Grammar

Copy the Code code as follows:


Setcookie (name, value, expire, path, domain);
* *
* Set Cookie
* N name
* C Value
* E validity 0 default one month 1 off immediate failure
/
Function W_cookie ($n, $c, $e = 0, $isde S=1)
{
if ($isdes ==1) {$c =endes ($c, Deskey);}
$exp = time () + 3600 * 24 * 30;
if ($e = = 0)
{
Setcookie ($n, $c, $exp, "/");
}
Else
{
Setcookie ($n, $c, 0, "/");
}
}
//Close Cookie Method
W_cookie (' BB ', ' www.3ppt.com ', $e = 0, $isdes =1);
!--? php 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 _CR
if ($val _CR
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 located in theLabel before. When a cookie is sent, the value of the cookie is automatically URL-encoded and automatically decoded upon retrieval (to prevent URL encoding, use Setrawcookie () instead).

The above describes the Fortunecookie php cookies to remove the general assignment method, including the fortunecookie aspect of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.