本文整理汇总了PHP中Symfony\Component\HttpFoundation\ResponseHeaderBag::clearCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP ResponseHeaderBag::clearCookie方法的具体用法?PHP ResponseHeaderBag::clearCookie怎么用?PHP ResponseHeaderBag::clearCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\ResponseHeaderBag
的用法示例。
在下文中一共展示了ResponseHeaderBag::clearCookie方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToStringIncludesCookieHeaders
public function testToStringIncludesCookieHeaders()
{
$bag = new ResponseHeaderBag(array());
$bag->setCookie(new Cookie('foo', 'bar'));
$this->assertContains("Set-Cookie: foo=bar; path=/; httponly", explode("\r\n", $bag->__toString()));
$bag->clearCookie('foo');
$this->assertContains("Set-Cookie: foo=deleted; expires=" . gmdate("D, d-M-Y H:i:s T", time() - 31536001) . "; httponly", explode("\r\n", $bag->__toString()));
}
示例2: testClearCookieSecureNotHttpOnly
public function testClearCookieSecureNotHttpOnly()
{
$bag = new ResponseHeaderBag(array());
$bag->clearCookie('foo', '/', null, true, false);
$this->assertRegExp('#^Set-Cookie: foo=deleted; expires=' . gmdate('D, d-M-Y H:i:s T', time() - 31536001) . '; path=/; secure#m', $bag->__toString());
}
示例3: testClearCookieSecureNotHttpOnly
public function testClearCookieSecureNotHttpOnly()
{
$bag = new ResponseHeaderBag(array());
$bag->clearCookie('foo', '/', null, true, false);
$this->assertContains("Set-Cookie: foo=deleted; expires=" . gmdate("D, d-M-Y H:i:s T", time() - 31536001) . "; path=/; secure", explode("\r\n", $bag->__toString()));
}
示例4: testClearCookieSecureNotHttpOnly
public function testClearCookieSecureNotHttpOnly()
{
$bag = new ResponseHeaderBag(array());
$bag->clearCookie('foo', '/', null, true, false);
$this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; secure', $bag);
}