You are here

public function HtmlResponse::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php \Zend\Diactoros\Response\HtmlResponse::__construct()

Create an HTML response.

Produces an HTML response with a Content-Type of text/html and a default status of 200.

Parameters

string|StreamInterface $html HTML or stream for the message body.:

int $status Integer status code for the response; 200 by default.:

array $headers Array of headers to use at initialization.:

Throws

InvalidArgumentException if $html is neither a string or stream.

Overrides Response::__construct

File

vendor/zendframework/zend-diactoros/src/Response/HtmlResponse.php, line 39

Class

HtmlResponse
HTML response.

Namespace

Zend\Diactoros\Response

Code

public function __construct($html, $status = 200, array $headers = []) {
  parent::__construct($this
    ->createBody($html), $status, $this
    ->injectContentType('text/html', $headers));
}