PHP Class Swoole\Protocol\HttpServer

Author: Tianfeng.Han
Inheritance: extends Swoole\Protocol\WebServer, implements Swoole\IFace\Protocol
Exibir arquivo Open project: matyhtf/swoole_framework Class Usage Examples

Protected Properties

Property Type Description
$buffer_header
$buffer_maxlen
$swoole_server

Public Methods

Method Description
__construct ( $config = [] ) 错误,丢弃此包
afterResponse ( Request $request, Response $response )
checkData ( $client_id, $http_data )
checkHeader ( $client_id, $http_data ) : boolean | Request
checkPost ( Request $request ) : integer
cleanBuffer ( $fd )
doStaticRequest ( Request $request, Response $response ) : boolean 过滤请求,阻止静止访问的目录,处理静态文件
getSwooleServer ( ) : swoole_server
httpError ( $code, Response $response, string $content = '' ) 发生了http错误
onClose ( $serv, $client_id, $from_id )
onConnect ( $serv, $client_id, $from_id )
onErrorHandle ( $errno, $errstr, $errfile, $errline ) 捕获set_error_handle错误
onErrorShutDown ( ) 捕获register_shutdown_function错误
onReceive ( $serv, $client_id, $from_id, $data ) : null 接收到数据
onRequest ( Request $request ) : Response 处理请求
onShutdown ( $serv )
onStart ( $serv, $worker_id )
parseRequest ( $request ) : null 解析请求
processDynamic ( Request $request, Response $response ) 处理动态请求
processStatic ( Request $request, Response $response ) : boolean 处理静态请求
response ( Request $request, Response $response ) : boolean 发送响应

Private Methods

Method Description
errorResponse ( $error ) 错误显示

Method Details

__construct() public method

错误,丢弃此包
public __construct ( $config = [] )

afterResponse() public method

public afterResponse ( Request $request, Response $response )
$request Swoole\Request
$response Swoole\Response

checkData() public method

public checkData ( $client_id, $http_data )

checkHeader() public method

public checkHeader ( $client_id, $http_data ) : boolean | Request
$client_id
$http_data
return boolean | Swoole\Request

checkPost() public method

public checkPost ( Request $request ) : integer
$request Swoole\Request
return integer

cleanBuffer() public method

public cleanBuffer ( $fd )

doStaticRequest() public method

过滤请求,阻止静止访问的目录,处理静态文件
public doStaticRequest ( Request $request, Response $response ) : boolean
$request Swoole\Request
$response Swoole\Response
return boolean

getSwooleServer() public method

public getSwooleServer ( ) : swoole_server
return swoole_server

httpError() public method

发生了http错误
public httpError ( $code, Response $response, string $content = '' )
$code
$response Swoole\Response
$content string

onClose() public method

public onClose ( $serv, $client_id, $from_id )

onConnect() public method

public onConnect ( $serv, $client_id, $from_id )

onErrorHandle() public method

捕获set_error_handle错误
public onErrorHandle ( $errno, $errstr, $errfile, $errline )

onErrorShutDown() public method

捕获register_shutdown_function错误
public onErrorShutDown ( )

onReceive() public method

接收到数据
public onReceive ( $serv, $client_id, $from_id, $data ) : null
$serv \swoole_server
$client_id
$from_id
$data
return null

onRequest() public method

处理请求
public onRequest ( Request $request ) : Response
$request Swoole\Request
return Swoole\Response

onShutdown() public method

public onShutdown ( $serv )

onStart() public method

public onStart ( $serv, $worker_id )

parseRequest() public method

解析请求
public parseRequest ( $request ) : null
$request Swoole\Request
return null

processDynamic() public method

处理动态请求
public processDynamic ( Request $request, Response $response )
$request Swoole\Request
$response Swoole\Response

processStatic() public method

处理静态请求
public processStatic ( Request $request, Response $response ) : boolean
$request Swoole\Request
$response Swoole\Response
return boolean

response() public method

发送响应
public response ( Request $request, Response $response ) : boolean
$request Swoole\Request Swoole\Request
$response Swoole\Response Swoole\Response
return boolean

Property Details

$buffer_header protected_oe property

protected $buffer_header

$buffer_maxlen protected_oe property

protected $buffer_maxlen

$swoole_server protected_oe property

protected $swoole_server