cookie and session

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>

posted @ 2012-08-10 17:38  Epirus  阅读(154)  评论(0编辑  收藏  举报