PHP Class think\Response

Datei anzeigen Open project: top-think/framework Class Usage Examples

Protected Properties

Property Type Description
$charset 字符集
$code 状态
$content
$contentType 当前的contentType
$data 原始数据
$header header参数
$options 输出参数

Public Methods

Method Description
__construct ( mixed $data = '', integer $code = 200, array $header = [], array $options = [] ) 架构函数
cacheControl ( string $cache ) 页面缓存控制
code ( integer $code ) 发送HTTP状态
content ( $content ) 设置页面输出内容
contentType ( string $contentType, string $charset = 'utf-8' ) 页面输出类型
create ( mixed $data = '', string $type = '', integer $code = 200, array $header = [], array $options = [] ) : Response | Json | View | Xml | Redirect | Jsonp 创建Response对象
data ( mixed $data ) 输出数据设置
eTag ( string $eTag ) ETag
expires ( string $time ) Expires
getCode ( ) : integer 获取状态码
getContent ( ) : mixed 获取输出数据
getData ( ) : mixed 获取原始数据
getHeader ( string $name = '' ) : mixed 获取头部信息
header ( string | array $name, string $value = null ) 设置响应头
lastModified ( string $time ) LastModified
options ( mixed $options = [] ) 输出的参数
send ( ) : mixed 发送数据到客户端

Protected Methods

Method Description
output ( mixed $data ) : mixed 处理数据

Method Details

__construct() public method

架构函数
public __construct ( mixed $data = '', integer $code = 200, array $header = [], array $options = [] )
$data mixed 输出数据
$code integer
$header array
$options array 输出参数

cacheControl() public method

页面缓存控制
public cacheControl ( string $cache )
$cache string 状态码

code() public method

发送HTTP状态
public code ( integer $code )
$code integer 状态码

content() public method

设置页面输出内容
public content ( $content )
$content

contentType() public method

页面输出类型
public contentType ( string $contentType, string $charset = 'utf-8' )
$contentType string 输出类型
$charset string 输出编码

create() public static method

创建Response对象
public static create ( mixed $data = '', string $type = '', integer $code = 200, array $header = [], array $options = [] ) : Response | Json | View | Xml | Redirect | Jsonp
$data mixed 输出数据
$type string 输出类型
$code integer
$header array
$options array 输出参数
return Response | Json | View | Xml | Redirect | Jsonp

data() public method

输出数据设置
public data ( mixed $data )
$data mixed 输出数据

eTag() public method

ETag
public eTag ( string $eTag )
$eTag string

expires() public method

Expires
public expires ( string $time )
$time string

getCode() public method

获取状态码
public getCode ( ) : integer
return integer

getContent() public method

获取输出数据
public getContent ( ) : mixed
return mixed

getData() public method

获取原始数据
public getData ( ) : mixed
return mixed

getHeader() public method

获取头部信息
public getHeader ( string $name = '' ) : mixed
$name string 头部名称
return mixed

header() public method

设置响应头
public header ( string | array $name, string $value = null )
$name string | array 参数名
$value string 参数值

lastModified() public method

LastModified
public lastModified ( string $time )
$time string

options() public method

输出的参数
public options ( mixed $options = [] )
$options mixed 输出参数

output() protected method

处理数据
protected output ( mixed $data ) : mixed
$data mixed 要处理的数据
return mixed

send() public method

发送数据到客户端
public send ( ) : mixed
return mixed

Property Details

$charset protected_oe property

字符集
protected $charset

$code protected_oe property

状态
protected $code

$content protected_oe property

protected $content

$contentType protected_oe property

当前的contentType
protected $contentType

$data protected_oe property

原始数据
protected $data

$header protected_oe property

header参数
protected $header

$options protected_oe property

输出参数
protected $options