\swoole_http_response

Http响应对象 Class swoole_http_response

Summary

Methods
Properties
Constants
end()
write()
header()
cookie()
status()
gzip()
sendfile()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

end()

end(string  $html = '') 

结束Http响应,发送HTML内容

Parameters

string $html

write()

write(  $html) 

启用Http-Chunk分段向浏览器发送数据

Parameters

$html

header()

header(  $key,   $value) 

设置Http头信息

Parameters

$key
$value

cookie()

cookie(string  $key, string  $value, integer  $expire, string  $path = '/', string  $domain = '', boolean  $secure = false, boolean  $httponly = false) 

设置Cookie

Parameters

string $key
string $value
integer $expire
string $path
string $domain
boolean $secure
boolean $httponly

status()

status(  $code) 

设置HttpCode,如404, 501, 200

Parameters

$code

gzip()

gzip(integer  $level = 1) 

设置Http压缩格式

Parameters

integer $level

sendfile()

sendfile(  $filename) 

发送静态文件

Parameters

$filename