Application::unsetCookie
クッキーを削除します
説明
public void Application::unsetCookie( string $name )
クッキーを削除します。過去の有効期限を付けて(パス/で)クッキーを送り直すので、ブラウザはそのクッキーを捨てます。現在のリクエストの残りの処理でも、getCookie()からは消えます。次のリクエストからは、ブラウザがそのクッキーを送らなくなります。
削除できるのは、パスが/のクッキーだけです。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $name | string | クッキーの名前 |
例
Controller - First request
$this->setCookie('foo', 'bar');
Controller - Second request
echo $this->getCookie('foo'); // -> bar
$this->unsetCookie('foo');
Controller - Third request
echo $this->getCookie('foo'); // -> ''