Responses
Responses are HTTP messages and/or data sent from web server.
In the Quantum framework responses are managed by Response
class, which extends the base HttpResponse
class. Responses can be outputted from server in different forms and contain special HTTP status code (like 301
, 404
, 500
, etc.).
The Response
class has several methods to sent header information:
Response::setHeader($key, $value)
- Sets new header information by given key and valueResponse::setCSRFToken($csrfToken)
- Sets Сross Site Request Forgery TokenResponse::setContentType($contentType)
- Sets the content typeResponse::setStatus($status)
- Sets the HTTP status code
The Response
class has also several methods to return or output the content:
Response::json($data, $status = NULL)
- Returns JSON encoded dataResponse::jsonOutput($data, $status = NULL)
- responses.json_outputResponse::xml(array $arr)
- Outputs reponse in XML format