Yaf_Response_Abstract::setHeader
(Yaf >=1.0.0)
Yaf_Response_Abstract::setHeader — The setHeader purpose
Description
public void Yaf_Response_Abstract::setHeader
( void
)
Warning
This function is currently not documented; only its argument list is available.
Parameters
This function has no parameters.
Return Values
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Другие базовые расширения
- Yet Another Framework
- Функция Yaf_Response_Abstract::appendBody() - append to body
- Функция Yaf_Response_Abstract::clearBody() - The clearBody purpose
- Функция Yaf_Response_Abstract::clearHeaders() - The clearHeaders purpose
- Функция Yaf_Response_Abstract::__clone() - The __clone purpose
- Функция Yaf_Response_Abstract::__construct() - The __construct purpose
- Функция Yaf_Response_Abstract::__destruct() - The __destruct purpose
- Функция Yaf_Response_Abstract::getBody() - Retrieve a exists content
- Функция Yaf_Response_Abstract::getHeader() - The getHeader purpose
- Функция Yaf_Response_Abstract::prependBody() - The prependBody purpose
- Функция Yaf_Response_Abstract::response() - send response
- Функция Yaf_Response_Abstract::setAllHeaders() - The setAllHeaders purpose
- Функция Yaf_Response_Abstract::setBody() - Set content to response
- Функция Yaf_Response_Abstract::setHeader() - The setHeader purpose
- Функция Yaf_Response_Abstract::setRedirect() - The setRedirect purpose
- Функция Yaf_Response_Abstract::__toString() - The __toString purpose
Коментарии
A few examples of how to send headers from a controller...
/* Set Content-Type */
$response = $this -> getResponse();
$response -> setHeader( 'Content-Type', 'text/html; charset=utf-8' );
$response -> response();
/* Set HTTP Status */
$response = $this -> getResponse();
$response -> setHeader( $this -> getRequest() -> getServer( 'SERVER_PROTOCOL' ), '404 Not Found' );
$response -> response();
You could also use $_SERVER[ 'SERVER_PROTOCOL' ] however it is recommend to extend the request class do some cleaning of the super globals then you should be good to go.