PHP Class Zend\Diactoros\Response\TextResponse

Allows creating a response by passing a string to the constructor; by default, sets a status code of 200 and sets the Content-Type header to text/plain.
Inheritance: extends Zend\Diactoros\Response, use trait InjectContentTypeTrait
显示文件 Open project: zendframework/zend-diactoros

Public Methods

Method Description
__construct ( string | Psr\Http\Message\StreamInterface $text, integer $status = 200, array $headers = [] ) Create a plain text response.

Private Methods

Method Description
createBody ( string | Psr\Http\Message\StreamInterface $text ) : Psr\Http\Message\StreamInterface Create the message body.

Method Details

__construct() public method

Produces a text response with a Content-Type of text/plain and a default status of 200.
public __construct ( string | Psr\Http\Message\StreamInterface $text, integer $status = 200, array $headers = [] )
$text string | Psr\Http\Message\StreamInterface String or stream for the message body.
$status integer Integer status code for the response; 200 by default.
$headers array Array of headers to use at initialization.