|
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]);
php技術:yii操作cookie實例簡介,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。