Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Response_Abstract::clearBodyYaf_Response_Abstract::__construct>
^Yaf_Response_AbstractLast updated: Mon, 26 Oct 2026

Yaf_Response_Abstract::clearHeaders

(Yaf >=1.0.0)

Yaf_Response_Abstract::clearHeaders — Remove all response headers

Description

public function Yaf_Response_Abstract::clearHeaders(): Yaf_Response_Abstract|false|null

Remove all HTTP response headers that have been set.

Note:

This method is only fully implemented in the Yaf_Response_Http subclass. In the abstract class it is a stub.

Parameters

This function has no parameters.

Return Values

Returns the response object itself on success, or false on failure.

Examples

Example #1 Yaf_Response_Abstract::clearHeaders() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $response = $this->getResponse();

        $response->setHeader("Content-Type", "application/json");
        $response->clearHeaders();

        var_dump($response->getHeader()); // array(0) { }
    }
}
?>

See Also


<Yaf_Response_Abstract::clearBodyYaf_Response_Abstract::__construct>
^Yaf_Response_AbstractLast updated: Mon, 26 Oct 2026