PHP header_remove() Function
Example
Remove specific header:
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
header_remove("Pragma");
?>
Definition and Usage
The header_remove() function removes an HTTP header previously set with the header() function.
Syntax
header_remove(headername)
Parameter Values
Parameter | Description |
---|---|
headername | Optional. Specifies a header name to be removed. If omitted, all previously set headers are removed |
Technical Details
Return Value: | Nothing |
---|---|
PHP Version: | 5.3+ |
More Examples
Example
Remove all previously set headers:
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
header_remove();
?>
❮ PHP Network Reference