Properties

$data

$data : mixed

原始数据

Type

mixed

$app

$app : \think\App

应用对象实例

Type

\think\App

$contentType

$contentType : string

当前contentType

Type

string

$charset

$charset : string

字符集

Type

string

$code

$code : integer

状态码

Type

integer

$allowCache

$allowCache : boolean

是否允许请求缓存

Type

boolean

$options

$options : array

输出参数

Type

array

$header

$header : array

header参数

Type

array

$content

$content : string

输出内容

Type

string

Methods

__construct()

__construct(mixed  $data = '', integer  $code = 200, array  $header = array(), array  $options = array()) 

架构函数

Parameters

mixed $data

输出数据

integer $code
array $header
array $options

输出参数

create()

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

创建Response对象

Parameters

mixed $data

输出数据

string $type

输出类型

integer $code
array $header
array $options

输出参数

Returns

\think\Response

send()

send() : void

发送数据到客户端

Throws

\InvalidArgumentException

options()

options(mixed  $options = array()) : $this

输出的参数

Parameters

mixed $options

输出参数

Returns

$this

data()

data(mixed  $data) : $this

输出数据设置

Parameters

mixed $data

输出数据

Returns

$this

allowCache()

allowCache(boolean  $cache) : $this

是否允许请求缓存

Parameters

boolean $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(integer  $code) : $this

发送HTTP状态

Parameters

integer $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() : integer

获取状态码

Returns

integer

__debugInfo()

__debugInfo() 

output()

output(mixed  $data) : mixed

处理数据

Parameters

mixed $data

要处理的数据

Throws

\Exception

Returns

mixed

sendData()

sendData(string  $data) : void

输出数据

Parameters

string $data

要处理的数据