cookis 设置,读取方法,跨域[二级域名]
$time =30;
$domain ='.111cn.net';
setcookie("abcde","aaaaaa");//最简单的cookie设置方法
setcookie('load','www.111cn.net',time()+3600*24,'/','.111cn.net'); //这里可以设置二级域名
$cookis = $_COOKIE['loadDomain'];//读取域名
print_r( $cookis );
/*
来看几个例子:
简单的:
SetCookie("MyCookie", "Value of MyCookie");
带失效时间的:
SetCookie("WithExpire", "Expire in 1 hour", time()+3600);//3600秒=1小时
什么都有的:
SetCookie("FullCookie", "Full cookie value", time()+3600, "/forum", ".111cn.net", 1);
*/
?>
<script language="javascript教程">
function setcookie(name,days)
{
var url = document.domain;
var exp = new Date();
exp.setTime(exp.getTime() + days*24*60*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教程 cookies
//asp教程 cookies
Response.Cookies("Uto")("UtorName")=UtorName
Response.Cookies("Uto")("UtorPwd")=UtorPwd
Response.Cookies("Uto").Domain="utoper.com"
Response.Cookies("Uto").Secure =False
|