yii对cookie的操作常见的主要有以下几种:

1.设置cookie:

$cookie = new CHttpCookie('mycookie','this is my cookie'); 
$cookie->expire = time()+60*60*24*30; //有限期30天 
Yii::app()->request->cookies['mycookie']=$cookie;

2.读取cookie:

$cookie = Yii::app()->request->getCookies(); 
echo $cookie['mycookie']->value;

3.销毁cookie:

$cookie = Yii::app()->request->getCookies(); 
unset($cookie[$name]);
标签:
yii,操作,cookie

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“yii操作cookie实例简介”

暂无“yii操作cookie实例简介”评论...