Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Zend_Controller_Response_Abstract
Base class for Zend_Controller responses
array $_body = 'array'Body content
DetailsException $_exceptions = 'array'Exception stack
Detailsarray $_headers = 'array'Array of headers. Each header is an array with keys 'name' and 'value'
Detailsarray $_headersRaw = 'array'Array of raw headers. Each header is a single string, the entire header to emit
Detailsint $_httpResponseCode = '200'HTTP response code to use in headers
Detailsboolean $_isRedirect = 'false'Flag; is this response a redirect?
Detailsboolean $_renderExceptions = 'false'Whether or not to render exceptions; off by default
Detailsboolean $headersSentThrowsException = 'true'Flag; if true, when header operations are called after headers have been sent, an exception will be raised; otherwise, processing will continue as normal. Defaults to true.
Details__toString(
)
:
stringMagic __toString functionality
Proxies to {@link sendResponse()} and returns response value as string using output buffering.
Details_normalizeHeader(
string $name
)
:
stringNormalize a header name
Normalizes a header name to X-Capitalized-Names
Detailsappend(
string $name, string $content
)
:
Zend_Controller_Response_AbstractAppend a named body segment to the body content array
If segment already exists, replaces with $content and places at end of array.
DetailsappendBody(
string $content, null|string $name
=
null
)
:
Zend_Controller_Response_AbstractAppend content to the body content
DetailscanSendHeaders(
boolean $throw
=
false
)
:
booleanCan we send headers?
DetailsclearAllHeaders(
)
:
Zend_Controller_Response_AbstractClear all headers, normal and raw
DetailsclearBody(
string $name
=
null
)
:
booleanClear body array
With no arguments, clears the entire body array. Given a $name, clears just that named segment; if no segment matching $name exists, returns false to indicate an error.
DetailsclearHeader(
string $name
)
:
Zend_Controller_Response_AbstractClears the specified HTTP header
DetailsclearHeaders(
)
:
Zend_Controller_Response_AbstractClear headers
DetailsclearRawHeader(
string $headerRaw
)
:
Zend_Controller_Response_AbstractClears the specified raw HTTP header
DetailsclearRawHeaders(
)
:
Zend_Controller_Response_AbstractClear all {@link setRawHeader() raw HTTP headers}
DetailsgetBody(
boolean $spec
=
false
)
:
string|array|nullReturn the body content
If $spec is false, returns the concatenated values of the body content array. If $spec is boolean true, returns the body content array. If $spec is a string and matches a named segment, returns the contents of that segment; otherwise, returns null.
DetailsgetException(
)
:
arrayRetrieve the exception stack
DetailsgetExceptionByCode(
mixed $code
)
:
voidRetrieve all exceptions of a given code
DetailsgetExceptionByMessage(
string $message
)
:
false|arrayRetrieve all exceptions of a given message
DetailsgetExceptionByType(
string $type
)
:
false|arrayRetrieve all exceptions of a given type
DetailsgetHeaders(
)
:
arrayReturn array of headers; see {@link $_headers} for format
DetailsgetHttpResponseCode(
)
:
intRetrieve HTTP response code
DetailsgetRawHeaders(
)
:
arrayRetrieve all {@link setRawHeader() raw HTTP headers}
DetailshasExceptionOfCode(
int $code
)
:
booleanDoes the response object contain an exception with a given code?
DetailshasExceptionOfMessage(
string $message
)
:
booleanDoes the response object contain an exception with a given message?
DetailshasExceptionOfType(
string $type
)
:
booleanDoes the response object contain an exception of a given type?
Detailsinsert(
string $name, string $content, string $parent
=
null, boolean $before
=
false
)
:
Zend_Controller_Response_AbstractInsert a named segment into the body content array
DetailsisException(
)
:
booleanHas an exception been registered with the response?
DetailsisRedirect(
)
:
booleanIs this a redirect?
DetailsoutputBody(
)
:
voidEcho the body segments
Detailsprepend(
string $name, string $content
)
:
voidPrepend a named body segment to the body content array
If segment already exists, replaces with $content and places at top of array.
DetailsrenderExceptions(
boolean $flag
=
null
)
:
booleanWhether or not to render exceptions (off by default)
If called with no arguments or a null argument, returns the value of the flag; otherwise, sets it and returns the current value.
DetailssendHeaders(
)
:
Zend_Controller_Response_AbstractSend all headers
Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} has been specified, it is sent with the first header.
DetailssendResponse(
)
:
voidSend the response, including all headers, rendering exceptions if so requested.
DetailssetBody(
string $content, null|string $name
=
null
)
:
Zend_Controller_Response_AbstractSet body content
If $name is not passed, or is not a string, resets the entire body and sets the 'default' key to $content.
If $name is a string, sets the named segment in the body array to $content.
DetailssetException(
Exception $e
)
:
Zend_Controller_Response_AbstractRegister an exception with the response
DetailssetHeader(
string $name, string $value, boolean $replace
=
false
)
:
Zend_Controller_Response_AbstractSet a header
If $replace is true, replaces any headers already defined with that $name.
DetailssetHttpResponseCode(
int $code
)
:
Zend_Controller_Response_AbstractSet HTTP response code to use with headers
DetailssetRawHeader(
string $value
)
:
Zend_Controller_Response_AbstractSet raw HTTP header
Allows setting non key => value headers, such as status codes
DetailssetRedirect(
string $url, int $code
=
302
)
:
Zend_Controller_Response_AbstractSet redirect URL
Sets Location header and response code. Forces replacement of any prior redirects.
Details