Table Of Contents

Previous topic

< Interface Phalcon\Http\Request\FileInterface

Next topic

Interface Phalcon\Http\Response\CookiesInterface >

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

<?php

$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