PHP 클래스 lithium\action\Response

The Response object is responsible for writing its body content to output, and writing any headers to the browser.
또한 보기: lithium\action\Dispatcher
또한 보기: lithium\action\Controller
상속: extends lithium\net\http\Response
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_autoConfig array Auto configuration properties.
$_classes array Classes used by Response.

공개 메소드들

메소드 설명
__construct ( array $config = [] ) : void Constructor. Adds config values to the public properties when a new object is created.
__toString ( ) : string Casts the Response object to a string. This doesn't actually return a string, but does a direct render and returns an empty string.
cache ( mixed $expires ) : void Controls how or whether the client browser and web proxies should cache this response.
headers ( string | array $key = null, mixed $value = null, boolean $replace = true ) : mixed Expands on \net\http\Message::headers() with some magic conversions for shorthand headers.
render ( ) : void Render a response by writing headers and output. Output is echoed in chunks because of an issue where echo time increases exponentially on long message bodies.
type ( string $type = null ) : string Sets/Gets the content type. If 'type' is null, the method will attempt to determine the type from the params, then from the environment setting

보호된 메소드들

메소드 설명
_init ( ) : void Sets the Location header using $config['location'] and $config['request'] passed in through the constructor if provided.
_writeHeaders ( string | array $headers, integer $code = null ) : void Writes raw headers to output.

메소드 상세

__construct() 공개 메소드

Config options also include default values for Response::body() when called from Response::render().
또한 보기: lithium\net\http\Message::body()
또한 보기: lithium\net\http\Response::__construct()
또한 보기: lithium\net\http\Message::__construct()
또한 보기: lithium\net\Message::__construct()
public __construct ( array $config = [] ) : void
$config array The available configuration options are the following. Further options are inherited from the parent classes. - `'buffer'` _integer_: Defaults to `null` - `'decode'` _boolean_: Defaults to `null`. - `'location'` _array|string|null_: Defaults to `null`. - `'request'` _object_: Defaults to `null`.
리턴 void

__toString() 공개 메소드

Casts the Response object to a string. This doesn't actually return a string, but does a direct render and returns an empty string.
public __toString ( ) : string
리턴 string Just an empty string to satify requirements of this magic method.

_init() 보호된 메소드

Sets the Location header using $config['location'] and $config['request'] passed in through the constructor if provided.
protected _init ( ) : void
리턴 void

_writeHeaders() 보호된 메소드

Writes raw headers to output.
protected _writeHeaders ( string | array $headers, integer $code = null ) : void
$headers string | array Either a raw header string, or an array of header strings. Use an array if a single header must be written multiple times with different values. Otherwise, additional values for duplicate headers will overwrite previous values.
$code integer Optional. If present, forces a specific HTTP response code. Used primarily in conjunction with the 'Location' header.
리턴 void

cache() 공개 메소드

Controls how or whether the client browser and web proxies should cache this response.
public cache ( mixed $expires ) : void
$expires mixed This can be a Unix timestamp indicating when the page expires, or a string indicating the relative time offset that a page should expire, i.e. `"+5 hours". Finally, `$expires` can be set to `false` to completely disable browser or proxy caching.
리턴 void

headers() 공개 메소드

Expands on \net\http\Message::headers() with some magic conversions for shorthand headers.
사용 중단: This method will be removed in a future version. Note that the parent `header()` wil continue to exist.
public headers ( string | array $key = null, mixed $value = null, boolean $replace = true ) : mixed
$key string | array
$value mixed
$replace boolean
리턴 mixed

render() 공개 메소드

Reponses which have a Location header set are indicating a redirect, will get their status code automatically adjusted to 302 (Found/Moved Temporarily) in case the status code before was 200 (OK). This is to allow easy redirects by setting just the Location header and is assumed to be the original intent of the user. On responses with status codes 204 (No Content) and 302 (Found) a message body - even if one is set - will never be send. These status codes either don't have a message body as per their nature or they are ignored and can thus be omitted for performance reasons.
public render ( ) : void
리턴 void

type() 공개 메소드

Sets/Gets the content type. If 'type' is null, the method will attempt to determine the type from the params, then from the environment setting
public type ( string $type = null ) : string
$type string a full content type i.e. `'application/json'` or simple name `'json'`
리턴 string A simple content type name, i.e. `'html'`, `'xml'`, `'json'`, etc., depending on the content type of the request.

프로퍼티 상세

$_autoConfig 보호되어 있는 프로퍼티

Auto configuration properties.
protected array $_autoConfig
리턴 array

$_classes 보호되어 있는 프로퍼티

Classes used by Response.
protected array $_classes
리턴 array