W3cubDocs

/Phalcon 2

Interface Phalcon\Http\ResponseInterface

Phalcon\Http\ResponseInterface initializer

Methods

abstract public Phalcon\Http\ResponseInterface setStatusCode (int $code, string $message)

Sets the HTTP response code

abstract public Phalcon\Http\Response\Headers getHeaders ()

Returns headers set by the user

abstract public Phalcon\Http\ResponseInterface setHeader (string $name, string $value)

Overwrites a header in the response

abstract public Phalcon\Http\ResponseInterface setRawHeader (string $header)

Send a raw header to the response

abstract public Phalcon\Http\ResponseInterface resetHeaders ()

Resets all the stablished headers

abstract public Phalcon\Http\ResponseInterface setExpires (DateTime $datetime)

Sets output expire time header

abstract public Phalcon\Http\ResponseInterface setNotModified ()

Sends a Not-Modified response

abstract public Phalcon\Http\ResponseInterface setContentType (string $contentType, [string $charset])

Sets the response content-type mime, optionally the charset

abstract public Phalcon\Http\ResponseInterface redirect ([string $location], [boolean $externalRedirect], [int $statusCode])

Redirect by HTTP to another action or URL

abstract public Phalcon\Http\ResponseInterface setContent (string $content)

Sets HTTP response body

abstract public Phalcon\Http\ResponseInterface setJsonContent (string $content)

Sets HTTP response body. The parameter is automatically converted to JSON

$response->setJsonContent(array("status" => "OK"));

abstract public Phalcon\Http\ResponseInterface appendContent (string $content)

Appends a string to the HTTP response body

abstract public string getContent ()

Gets the HTTP response body

abstract public Phalcon\Http\ResponseInterface sendHeaders ()

Sends headers to the client

abstract public Phalcon\Http\ResponseInterface sendCookies ()

Sends cookies to the client

abstract public Phalcon\Http\ResponseInterface send ()

Prints out HTTP response to the client

abstract public setFileToSend (string $filePath, [string $attachmentName])

Sets an attached file to be sent at the end of the request

© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Http_ResponseInterface.html