Guest User

Untitled

a guest
Dec 16th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. $cityCookie = Yii::$app->request->cookies[self::COOKIE_CITY_ID];
  2. $cityCookie->expire = -1;
  3. $cityCookie->path = '/';
  4. $cityCookie->value = null;
  5.  
  6. setcookie(self::COOKIE_CITY_ID, null, -1, '/');
  7.  
  8. $cookies = Yii::$app->response->cookies;
  9. // add a new cookie to the response to be sent
  10. $cookies->add(new yiiwebCookie([
  11. 'name' => 'language',
  12. 'value' => 'zh-CN',
  13. ]));
  14. // remove a cookie
  15. $cookies->remove('language');
Add Comment
Please, Sign In to add comment