(Yaf >=1.0.0)
Yaf_Response_Abstract::getHeader — Retrieve an HTTP response header
$name
Retrieve an HTTP response header.
Note: This method is only fully implemented in the Yaf_Response_Http subclass. In the abstract class it is a stub.
Note:
This method is only fully implemented in the Yaf_Response_Http subclass. In the abstract class it is a stub.
name
The header name. If omitted, all headers are returned as an array.
The header value as a string, or an array of all headers when the name is omitted. Returns null if the requested header is not set.
null
Example #1 Yaf_Response_Abstract::getHeader() example
<?php class IndexController extends Yaf_Controller_Abstract { public function indexAction() { $response = $this->getResponse(); $response->setHeader("Content-Type", "application/json"); var_dump($response->getHeader("Content-Type")); var_dump($response->getHeader()); // all headers var_dump($response->getHeader("X-Missing")); } } ?>
The above example will output something similar to:
string(16) "application/json" array(1) { ["Content-Type"]=> string(16) "application/json" } NULL