Repository navigation
removeCookie
Aidan Woods edited this page Jul 16, 2017
·
2 revisions
void removeCookie ( string $name )Remove a cookie from SecureHeaders' internal list (thus preventing the
Set-Cookie header for that specific cookie from being sent).
This allows you to form a blacklist for cookies that should not be sent
(either programatically or globally, depending on where this is
configured).
The (case-insensitive) name of the cookie to remove.
$headers->applyOnOutput();
$headers->removeCookie('cookie1');
setcookie('cookie1');
setcookie('cookie2');
setcookie('cookIE3');
$headers->removeCookie('cookie3');The cookie with the name cookie2 will be sent, the others will be removed.
(Note there is no need to call ->apply() after any of this because ->applyOnOutput() was configured to send the headers on the first byte of output).