public function remove($cookie, $removeFromBrowser = true)
    {
        if ($this->readOnly) {
            throw new InvalidCallException('The cookie collection is read only.');
        }
        if ($cookie instanceof Cookie) {
            $cookie->expire = 1;
            $cookie->value = '';
        } else {
            $cookie = Yii::createObject([
                'class' => 'yii\web\Cookie',
                'name' => $cookie,
                'expire' => 1,
            ]);
        }
        if ($removeFromBrowser) {
            $this->_cookies[$cookie->name] = $cookie;
        } else {
            unset($this->_cookies[$cookie->name]);
        }
    }
public function remove($cookie, $removeFromBrowser = true)
    {
        if ($this->readOnly) {
            throw new InvalidCallException('The cookie collection is read only.');
        }
        if ($cookie instanceof Cookie) {
            $cookie->expire = 1;
            $cookie->value = '';
        } else {
            $cookie = Yii::createObject([
                'class' => 'yii\web\Cookie',
                'name' => $cookie,
                'expire' => 1,
            ]);
        }
        if ($removeFromBrowser) {
            $this->_cookies[$cookie->name] = $cookie;
        } else {
            unset($this->_cookies[$cookie->name]);
        }
    }
public function remove ( $ cookie , $ removeFromBrowser = true ) { if ( $ this -> readOnly ) { throw new InvalidCallException ( 'The cookie collection is read only.' ) ; } if ( $ cookie instanceof Cookie ) { $ cookie -> expire = 1 ; $ cookie -> value = '' ; } else { $ cookie = Yii :: createObject ( [ 'class' => 'yii\web\Cookie' , 'name' => $ cookie , 'expire' => 1 , ] ) ; } if ( $ removeFromBrowser ) { $ this -> _cookies [ $ cookie -> name ] = $ cookie ; } else { unset ( $ this -> _cookies [ $ cookie -> name ] ) ; } }
Removes a cookie.
If `$removeFromBrowser` is true, the cookie will be removed from the browser.
In this case, a cookie with outdated expiry will be added to the collection.
@param Cookie|string $cookie the cookie object or the name of the cookie to be removed.
@param bool $removeFromBrowser whether to remove the cookie from browser
@throws InvalidCallException if the cookie collection is read only
Removes a cookie . If $removeFromBrowser is true the cookie will be removed from the browser . In this case a cookie with outdated expiry will be added to the collection .