think\Response::__construct PHP Method

__construct() public method

架构函数
public __construct ( mixed $data = '', integer $code = 200, array $header = [], array $options = [] )
$data mixed 输出数据
$code integer
$header array
$options array 输出参数
    public function __construct($data = '', $code = 200, array $header = [], $options = [])
    {
        $this->data($data);
        $this->header = $header;
        $this->code = $code;
        if (!empty($options)) {
            $this->options = array_merge($this->options, $options);
        }
        $this->contentType($this->contentType, $this->charset);
    }

Usage Example

Example #1
0
 public function __construct($data = '', $code = 302, array $header = [], array $options = [])
 {
     parent::__construct($data, $code, $header, $options);
     $this->cacheControl('no-cache,must-revalidate');
 }