Cookis settings, read method, cross-domain [second-level domain name]
$ Time = 30;
$ Domain = '.111cn.net ';
Setcookie ("abcde", "aaaaaa"); // The simplest cookie setting method
Setcookie ('load', 'www .111cn.net ', time () + 3600*24,'/',' .111cn.net '); // second-level domain names can be set here
$ Cookis = $ _ COOKIE ['loaddomain ']; // read the domain name
Print_r ($ cookis );
/*
Here are several examples:
Simple:
SetCookie ("MyCookie", "Value of MyCookie ");
With expiration time:
SetCookie ("WithExpire", "Expire in 1 hour", time () + 3600); // 3600 seconds = 1 hour
Everything:
SetCookie ("FullCookie", "Full cookie value", time () + 3600, "/forum", ".111cn.net", 1 );
*/
?>
<Script language = "javascript tutorial">
Function setcookie (name, days)
{
Var url = document. domain;
Var exp = new Date ();
Exp. setTime (exp. getTime () + days x 24x60*60*1000 );
Document. cookie = name + "=" + escape (url) + "; expires =" + exp. toGMTString ();
}
Function getcookie (name)
{
Var arr = document. cookie. match (new RegExp ("[sS] *" + name + "= ([^;] *)");
Alert (arr );
If (arr! = Null)
Return unescape (arr [1]);
Return null;
}
</Script>
// Php Tutorial cookies
// Asp tutorial cookies
Response. Cookies ("Uto") ("UtorName") = UtorName
Response. Cookies ("Uto") ("UtorPwd") = UtorPwd
Response. Cookies ("Uto"). Domain = "utoper.com"
Response. Cookies ("Uto"). Secure = False