Zend Framework
1.12
|
Public Member Functions | |
setHeader ($name, $value, $replace=false) | |
Set a header. | |
setRedirect ($url, $code=302) | |
Set redirect URL. | |
isRedirect () | |
Is this a redirect? | |
getHeaders () | |
Return array of headers; see $_headers for format. | |
clearHeaders () | |
Clear headers. | |
clearHeader ($name) | |
Clears the specified HTTP header. | |
setRawHeader ($value) | |
Set raw HTTP header. | |
getRawHeaders () | |
Retrieve all raw HTTP headers. | |
clearRawHeaders () | |
Clear all raw HTTP headers. | |
clearRawHeader ($headerRaw) | |
Clears the specified raw HTTP header. | |
clearAllHeaders () | |
Clear all headers, normal and raw. | |
setHttpResponseCode ($code) | |
Set HTTP response code to use with headers. | |
getHttpResponseCode () | |
Retrieve HTTP response code. | |
canSendHeaders ($throw=false) | |
Can we send headers? | |
sendHeaders () | |
Send all headers. | |
setBody ($content, $name=null) | |
Set body content. | |
appendBody ($content, $name=null) | |
Append content to the body content. | |
clearBody ($name=null) | |
Clear body array. | |
getBody ($spec=false) | |
Return the body content. | |
append ($name, $content) | |
Append a named body segment to the body content array. | |
prepend ($name, $content) | |
Prepend a named body segment to the body content array. | |
insert ($name, $content, $parent=null, $before=false) | |
Insert a named segment into the body content array. | |
outputBody () | |
Echo the body segments. | |
setException (Exception $e) | |
Register an exception with the response. | |
getException () | |
Retrieve the exception stack. | |
isException () | |
Has an exception been registered with the response? | |
hasExceptionOfType ($type) | |
Does the response object contain an exception of a given type? | |
hasExceptionOfMessage ($message) | |
Does the response object contain an exception with a given message? | |
hasExceptionOfCode ($code) | |
Does the response object contain an exception with a given code? | |
getExceptionByType ($type) | |
Retrieve all exceptions of a given type. | |
getExceptionByMessage ($message) | |
Retrieve all exceptions of a given message. | |
getExceptionByCode ($code) | |
Retrieve all exceptions of a given code. | |
renderExceptions ($flag=null) | |
Whether or not to render exceptions (off by default) | |
sendResponse () | |
Send the response, including all headers, rendering exceptions if so requested. | |
__toString () | |
Magic __toString functionality. | |
Public Attributes | |
$headersSentThrowsException = true | |
Protected Member Functions | |
_normalizeHeader ($name) | |
Normalize a header name. | |
Protected Attributes | |
$_body = array() | |
$_exceptions = array() | |
$_headers = array() | |
$_headersRaw = array() | |
$_httpResponseCode = 200 | |
$_isRedirect = false | |
$_renderExceptions = false | |
__toString | ( | ) |
Magic __toString functionality.
Proxies to sendResponse() and returns response value as string using output buffering.
|
protected |
Normalize a header name.
Normalizes a header name to X-Capitalized-Names
string | $name |
append | ( | $name, | |
$content | |||
) |
Append a named body segment to the body content array.
If segment already exists, replaces with $content and places at end of array.
string | $name | |
string | $content |
appendBody | ( | $content, | |
$name = null |
|||
) |
Append content to the body content.
string | $content | |
null | string | $name |
canSendHeaders | ( | $throw = false | ) |
Can we send headers?
boolean | $throw | Whether or not to throw an exception if headers have been sent; defaults to false |
Zend_Controller_Response_Exception |
clearAllHeaders | ( | ) |
Clear all headers, normal and raw.
clearBody | ( | $name = null | ) |
Clear 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.
string | $name | Named segment to clear |
clearHeader | ( | $name | ) |
clearHeaders | ( | ) |
Clear headers.
clearRawHeader | ( | $headerRaw | ) |
Clears the specified raw HTTP header.
string | $headerRaw |
clearRawHeaders | ( | ) |
Clear all raw HTTP headers.
getBody | ( | $spec = false | ) |
Return 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.
boolean | $spec |
getException | ( | ) |
Retrieve the exception stack.
getExceptionByCode | ( | $code | ) |
Retrieve all exceptions of a given code.
mixed | $code |
getExceptionByMessage | ( | $message | ) |
Retrieve all exceptions of a given message.
string | $message |
getExceptionByType | ( | $type | ) |
Retrieve all exceptions of a given type.
string | $type |
getHeaders | ( | ) |
Return array of headers; see $_headers for format.
getHttpResponseCode | ( | ) |
Retrieve HTTP response code.
getRawHeaders | ( | ) |
Retrieve all raw HTTP headers.
hasExceptionOfCode | ( | $code | ) |
Does the response object contain an exception with a given code?
int | $code |
hasExceptionOfMessage | ( | $message | ) |
Does the response object contain an exception with a given message?
string | $message |
hasExceptionOfType | ( | $type | ) |
Does the response object contain an exception of a given type?
string | $type |
insert | ( | $name, | |
$content, | |||
$parent = null , |
|||
$before = false |
|||
) |
Insert a named segment into the body content array.
string | $name | |
string | $content | |
string | $parent | |
boolean | $before | Whether to insert the new segment before or after the parent. Defaults to false (after) |
isException | ( | ) |
Has an exception been registered with the response?
isRedirect | ( | ) |
Is this a redirect?
outputBody | ( | ) |
Echo the body segments.
prepend | ( | $name, | |
$content | |||
) |
Prepend a named body segment to the body content array.
If segment already exists, replaces with $content and places at top of array.
string | $name | |
string | $content |
renderExceptions | ( | $flag = null | ) |
Whether 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.
boolean | $flag | Optional |
sendHeaders | ( | ) |
Send all headers.
Sends any headers specified. If an HTTP response code has been specified, it is sent with the first header.
sendResponse | ( | ) |
Send the response, including all headers, rendering exceptions if so requested.
setBody | ( | $content, | |
$name = null |
|||
) |
Set 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.
string | $content | |
null | string | $name |
setException | ( | Exception | $e | ) |
Register an exception with the response.
Exception | $e |
setHeader | ( | $name, | |
$value, | |||
$replace = false |
|||
) |
Set a header.
If $replace is true, replaces any headers already defined with that $name.
string | $name | |
string | $value | |
boolean | $replace |
setHttpResponseCode | ( | $code | ) |
Set HTTP response code to use with headers.
int | $code |
setRawHeader | ( | $value | ) |
Set raw HTTP header.
Allows setting non key => value headers, such as status codes
string | $value |
setRedirect | ( | $url, | |
$code = 302 |
|||
) |
Set redirect URL.
Sets Location header and response code. Forces replacement of any prior redirects.
string | $url | |
int | $code |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
$headersSentThrowsException = true |