您的位置:首页 > 其它

cookie and session

2012-08-10 17:38 239 查看
1.COOKIE AND SESSION

COOKIE was saved in client;

session was saved in server;

2.cookie configuration

Setcookie(string name,string value ,int expire,string path,string domain,int secure);

expire:limited time;

eg.SetCookie("MyCookie","fwefwefwe",time()+3600,"/forum","evocacs.php100.com")

recieve cookie

$_COOKIE["MyCookie"];

delete cookie

SetCookie("Cookie","");

pay attention1: if you set cookie ,you should befor HTML DOC

2.Session

session_start();

$_SESSION[name]=value;

isset($_SESSION[name]);

unset($_SESSION[name]);

session_destroy();  

3.cookie

if you set the cookie and you need to refresh the page :

code : <javascritp> location.href="local.php" <javascript>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: