Properties

$data

$data : 

Type

$contentType

$contentType : 

Type

$charset

$charset : 

Type

$code

$code : 

Type

$options

$options : 

Type

$header

$header : 

Type

$content

$content : 

Type

$params

$params : 

Type

Methods

__construct()

__construct(mixed  $data = '', integer  $code = 302, 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|\think\response\Json|\think\response\View|\think\response\Xml|\think\response\Redirect|\think\response\Jsonp

创建Response对象

Parameters

mixed $data

输出数据

string $type

输出类型

integer $code
array $header
array $options

输出参数

Returns

\think\Response|\think\response\Json|\think\response\View|\think\response\Xml|\think\response\Redirect|\think\response\Jsonp

send()

send() : mixed

发送数据到客户端

Throws

\InvalidArgumentException

Returns

mixed

options()

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

输出的参数

Parameters

mixed $options

输出参数

Returns

$this

data()

data(mixed  $data) : $this

输出数据设置

Parameters

mixed $data

输出数据

Returns

$this

header()

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

设置响应头

Parameters

string|array $name

参数名

string $value

参数值

Returns

$this

content()

content(  $content) : $this

设置页面输出内容

Parameters

$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

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

with()

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

重定向传值(通过Session)

Parameters

string|array $name

变量名或者数组

mixed $value

Returns

$this

getTargetUrl()

getTargetUrl() : string

获取跳转地址

Returns

string

params()

params(  $params = array()) 

Parameters

$params

remember()

remember() : $this

记住当前url后跳转

Returns

$this

restore()

restore() : $this

跳转到上次记住的url

Returns

$this

output()

output(mixed  $data) : mixed

处理数据

Parameters

mixed $data

要处理的数据

Returns

mixed