$cookies =Yii:: $app->response ->cookies;
向cookies中添加数据
$cookie_data =array( 'name'=>'user' ,'value'=> '张三' );
$cookies->add (new Cookie($cookie_data));
修改cookies中数据
$cookie_data =array( 'name'=>'user' ,'value'=> '李四' );
$cookies->add (new Cookie($cookie_data));
删除cookies中数据
$cookies ->remove( 'user');
获取session中数据
$cookies =Yii:: $app->request ->cookies;
echo $cookies-> getValue('user' ,20);