PHP
事件 | Event

EventHttpRequest (class)

The EventHttpRequest class

介绍

(PECL event >= 1.4.0-beta)

代表一个HTTP请求。

类简介

EventHttpRequest {

/* Constants */

const integer CMD_GET = 1 ;

const integer CMD_POST = 2 ;

const integer CMD_HEAD = 4 ;

const integer CMD_PUT = 8 ;

const integer CMD_DELETE = 16 ;

const integer CMD_OPTIONS = 32 ;

const integer CMD_TRACE = 64 ;

const integer CMD_CONNECT = 128 ;

const integer CMD_PATCH = 256 ;

const integer INPUT_HEADER = 1 ;

const integer OUTPUT_HEADER = 2 ;

/* Methods */

public bool addHeader ( string $key , string $value , int $type )

public void cancel ( void )

public void clearHeaders ( void )

public void closeConnection ( void )

public __construct ( callable $callback [, mixed $data = NULL ] )

public void findHeader ( string $key , string $type )

public void free ( void )

public EventBufferEvent closeConnection ( void )

public void getCommand ( void )

public EventHttpConnection closeConnection ( void )

public string getHost ( void )

public EventBuffer getInputBuffer ( void )

public array getInputHeaders ( void )

public EventBuffer getOutputBuffer ( void )

public void getOutputHeaders ( void )

public int getResponseCode ( void )

public string getUri ( void )

public void removeHeader ( string $key , string $type )

public void sendError ( int $error [, string $reason = NULL ] )

public void sendReply ( int $code , string $reason [, EventBuffer $buf ] )

public void sendReplyChunk ( EventBuffer $buf )

public void sendReplyEnd ( void )

public void sendReplyStart ( int $code , string $reason )

}

预定义的常量

EventHttpRequest::CMD_GET

GET method(command)

EventHttpRequest::CMD_POST

POST method(command)

EventHttpRequest::CMD_HEAD

HEAD method(command)

EventHttpRequest::CMD_PUT

PUT method(command)

EventHttpRequest::CMD_DELETE

DELETE command(method)

EventHttpRequest::CMD_OPTIONS

OPTIONS method(command)

EventHttpRequest::CMD_TRACE

TRACE method(command)

EventHttpRequest::CMD_CONNECT

CONNECT method(command)

EventHttpRequest::CMD_PATCH

PATCH method(command)

EventHttpRequest::INPUT_HEADER

Request input header type.

EventHttpRequest::OUTPUT_HEADER

请求输出标题类型。

目录

  • EventHttpRequest :: addHeader - 将HTTP头添加到请求的头部

  • EventHttpRequest :: cancel - 取消挂起的HTTP请求

  • EventHttpRequest :: clearHeaders - 从请求的标题列表中删除所有输出标题

  • EventHttpRequest :: closeConnection - 关闭关联的HTTP连接

  • EventHttpRequest :: __ construct - 构造EventHttpRequest对象

  • EventHttpRequest :: findHeader - 查找属于标题的值

  • EventHttpRequest :: getBufferEvent - 返回EventBufferEvent对象

  • EventHttpRequest :: getCommand - 返回请求命令(方法)

  • EventHttpRequest :: getConnection - 返回EventHttpConnection对象

  • EventHttpRequest :: getHost - 返回请求主机

  • EventHttpRequest :: getInputBuffer - 返回输入缓冲区

  • EventHttpRequest :: getInputHeaders - 返回输入标题的关联数组

  • EventHttpRequest :: getOutputBuffer - 返回请求的输出缓冲区

  • EventHttpRequest :: getOutputHeaders - 返回输出标题的关联数组

  • EventHttpRequest :: getResponseCode - 返回响应代码

  • EventHttpRequest :: getUri - 返回请求URI

  • EventHttpRequest :: removeHeader - 从请求头中删除一个HTTP头

  • EventHttpRequest :: sendError - 向客户端发送HTML错误消息

  • EventHttpRequest :: sendReply - 向客户端发送HTML回复

  • EventHttpRequest :: sendReplyChunk - 发送另一个数据块作为正在进行的分块回复的一部分

  • EventHttpRequest :: sendReplyEnd - 完成一个分块回复,根据需要释放请求

  • EventHttpRequest :: sendReplyStart - 启动分块回复

← EventHttpConnection::setTimeout

EventHttpRequest::addHeader →