Yii2.0 Cookies操作
1.添加修改cookies
$cookie=array("name"=>"user","value"=>"demo1","expire"=>24*3600,‘httpOnly' => true,); Yii::$app->response->cookies->add(new Cookie($cookie));
2.删除cookies
Yii::$app->response->cookies->remove("user");
3.获取cookies
$a=Yii::$app->response->cookies->get('user');//返回一个\yii\web\Cookie对象
$a=Yii::$app->request->cookies->getValue('user');//直接返回Cookie的值
print_r($a);