Properties

$data

$data : mixed

原始数据

Type

mixed

$app

$app : \think\App

应用对象实例

Type

App

$contentType

$contentType : string

当前contentType

Type

string

$charset

$charset : string

字符集

Type

string

$code

$code : int

状态码

Type

int

$allowCache

$allowCache : bool

是否允许请求缓存

Type

bool

$options

$options : array

输出参数

Type

array

$header

$header : array

header参数

Type

array

$content

$content : string

输出内容

Type

string

Methods

__construct()

__construct(mixed  $data = '', int  $code = 200, array  $header = [], array  $options = []) : mixed

架构函数

Parameters

mixed $data

输出数据

int $code
array $header
array $options

输出参数

Returns

mixed —

create()

create(mixed  $data = '', string  $type = '', int  $code = 200, array  $header = [], array  $options = []) : \think\Response

创建Response对象

Parameters

mixed $data

输出数据

string $type

输出类型

int $code
array $header
array $options

输出参数

Returns

\think\Response —

send()

send() : void

发送数据到客户端

Throws

\InvalidArgumentException

options()

options(mixed  $options = []) : $this

输出的参数

Parameters

mixed $options

输出参数

Returns

$this —

data()

data(mixed  $data) : $this

输出数据设置

Parameters

mixed $data

输出数据

Returns

$this —

allowCache()

allowCache(bool  $cache) : $this

是否允许请求缓存

Parameters

bool $cache

允许请求缓存

Returns

$this —

header()

header(string|array  $name, string  $value = null) : $this

设置响应头

Parameters

string|array $name

参数名

string $value

参数值

Returns

$this —

content()

content(mixed  $content) : $this

设置页面输出内容

Parameters

mixed $content

Returns

$this —

code()

code(int  $code) : $this

发送HTTP状态

Parameters

int $code

状态码

Returns

$this —

lastModified()

lastModified(string  $time) : $this

LastModified

Parameters

string $time

Returns

$this —

expires()

expires(string  $time) : $this

Expires

Parameters

string $time

Returns

$this —

eTag()

eTag(string  $eTag) : $this

ETag

Parameters

string $eTag

Returns

$this —

cacheControl()

cacheControl(string  $cache) : $this

页面缓存控制

Parameters

string $cache

缓存设置

Returns

$this —

noCache()

noCache() : $this

设置页面不做任何缓存

Returns

$this —

contentType()

contentType(string  $contentType, string  $charset = 'utf-8') : $this

页面输出类型

Parameters

string $contentType

输出类型

string $charset

输出编码

Returns

$this —

getHeader()

getHeader(string  $name = '') : mixed

获取头部信息

Parameters

string $name

头部名称

Returns

mixed —

getData()

getData() : mixed

获取原始数据

Returns

mixed —

getContent()

getContent() : mixed

获取输出数据

Returns

mixed —

getCode()

getCode() : int

获取状态码

Returns

int —

__debugInfo()

__debugInfo() : mixed

Returns

mixed —

output()

output(mixed  $data) : mixed

处理数据

Parameters

mixed $data

要处理的数据

Throws

\Exception

Returns

mixed —

sendData()

sendData(string  $data) : void

输出数据

Parameters

string $data

要处理的数据