Properties

$verb

$verb : string

Type

string — HTTP请求方法

$collectionOptions

$collectionOptions : array

Type

array — 操作资源集合所支持的HTTP请求方法

$resourceOptions

$resourceOptions : array

Type

array — 操作资源所支持的HTTP请求方法

$objectPoolBuckets

$objectPoolBuckets : array

Type

array — 当前请求已使用的对象列表

$requestStartTime

$requestStartTime : float

Type

float — 请求开始处理的时间

$requestType

$requestType : string

Type

string — TCP_REQUEST|HTTP_REQUEST 请求类型

$__useCount

$__useCount : integer

Type

integer — 作用计数

$__genTime

$__genTime : integer

Type

integer — 创建时间

$__isContruct

$__isContruct : boolean

Type

boolean — 是否执行构造方法

$stdClass

$stdClass : \stdClass|null

Type

\stdClass|null — 对象模板

$objectPool

$objectPool : \PG\AOP\Wrapper|\PG\MSF\Base\Pool

Type

\PG\AOP\Wrapper|\PG\MSF\Base\Pool — 对象池

$__isDestroy

$__isDestroy : boolean

Type

boolean — 销毁标志

$redisPools

$redisPools : array

Type

array — redis连接池

$mysqlPools

$mysqlPools : array

Type

array — mysql连接池

$redisProxies

$redisProxies : array

Type

array — redis代理池

$reflections

$reflections : array

Type

array — 反射类属性的默认值

Methods

__construct()

__construct() 

构造方法

getIsGet()

getIsGet() : boolean

返回当前请求是否为GET

Returns

boolean

getIsOptions()

getIsOptions() : boolean

返回当前请求是否为OPTIONS

Returns

boolean

getIsHead()

getIsHead() : boolean

返回当前请求是否为HEAD

Returns

boolean

getIsPost()

getIsPost() : boolean

返回当前请求是否为POST

Returns

boolean

getIsDelete()

getIsDelete() : boolean

返回当前请求是否为DELETE

Returns

boolean

getIsPut()

getIsPut() : boolean

返回当前请求是否为PUT

Returns

boolean

getIsPatch()

getIsPatch() : boolean

返回当前请求是否为PATCH

Returns

boolean

outputJson()

outputJson(mixed|null  $data = null, integer  $status = 200) : void

响应json格式数据

Parameters

mixed|null $data

响应数据

integer $status

响应HTTP状态码

outputOptions()

outputOptions(array  $options) 

响应options请求

Parameters

array $options

OPTIONS

onExceptionHandle()

onExceptionHandle(\Throwable  $e) 

异常的回调

Parameters

\Throwable $e

异常实例

Throws

\Throwable

getObjectPool()

getObjectPool() : \PG\AOP\Wrapper|\PG\MSF\Base\Pool

获取对象池

Returns

\PG\AOP\Wrapper|\PG\MSF\Base\Pool

setObjectPool()

setObjectPool(\PG\AOP\Wrapper|\PG\MSF\Base\Pool|NULL  $objectPool) : $this

设置对象池

Parameters

\PG\AOP\Wrapper|\PG\MSF\Base\Pool|NULL $objectPool

Pool实例

Returns

$this

setRequestType()

setRequestType(string  $requestType) : $this

设置请求类型

Parameters

string $requestType

TCP_REQUEST|HTTP_REQUEST

Returns

$this

getRequestType()

getRequestType() : string

返回请求类型

Returns

string

destroy()

destroy() 

销毁,解除引用

output()

output(mixed|null  $data = null, integer  $status = 200) : void

响应原始数据

Parameters

mixed|null $data

响应数据

integer $status

响应HTTP状态码

outputView()

outputView(array  $data, string|null  $view = null) : void

通过模板引擎响应输出HTML

Parameters

array $data

待渲染KV数据

string|null $view

文件名

Throws

\Exception
\Throwable
\Exception

__sleep()

__sleep() : array

在序列化及dump对象时使用,代表哪些属于需要导出

Returns

array

__unsleep()

__unsleep() 

和__sleep作用相反

getServerInstance()

getServerInstance() : \swoole_server

获取运行Server实例

Returns

\swoole_server

getConfig()

getConfig() : \Noodlehaus\Config

获取运行server实例配置对象

Returns

\Noodlehaus\Config

getPack()

getPack() : \PG\MSF\Pack\IPack

获取运行server实例打包对象

Returns

\PG\MSF\Pack\IPack

getRedisPool()

getRedisPool(string  $poolName) : boolean|\PG\AOP\Wrapper|\PG\MSF\Pools\CoroutineRedisProxy|\Redis

获取Redis连接池

Parameters

string $poolName

配置的Redis连接池名称

Returns

boolean|\PG\AOP\Wrapper|\PG\MSF\Pools\CoroutineRedisProxy|\Redis

getMysqlPool()

getMysqlPool(string  $poolName) : boolean|\PG\AOP\Wrapper

获取MySQL连接池

Parameters

string $poolName

配置的MySQL连接池名称

Returns

boolean|\PG\AOP\Wrapper

getRedisProxy()

getRedisProxy(string  $proxyName) : boolean|\PG\AOP\Wrapper|\PG\MSF\Pools\CoroutineRedisProxy|\Redis

获取Redis代理

Parameters

string $proxyName

配置的Redis代理名称

Throws

\Exception

Returns

boolean|\PG\AOP\Wrapper|\PG\MSF\Pools\CoroutineRedisProxy|\Redis

setRedisPools()

setRedisPools(array|null  $redisPools) : $this

设置RedisPools

Parameters

array|null $redisPools

多个Redis连接池实例,通常用于销毁Redis连接池,赋值为NULL

Returns

$this

setRedisProxies()

setRedisProxies(array|null  $redisProxies) : $this

设置RedisPools

Parameters

array|null $redisProxies

多个Redis代理实例,通常用于销毁Redis代理,赋值为NULL

Returns

$this

isUse()

isUse() 

对象已使用标识

getIsDestroy()

getIsDestroy() : boolean

是否已经执行destroy

Returns

boolean

setContext()

setContext(\PG\MSF\Helpers\Context  $context) : $this

设置上下文

Parameters

\PG\MSF\Helpers\Context $context

请求上下文对象

Returns

$this

actionCreate()

actionCreate() 

POST /rests x-www-form-urlencoded [ 'p1' => 1, 'p2' => 'Hello', ]

actionIndex()

actionIndex() 

GET /rests?p1=1&p2=Hello

actionView()

actionView() 

GET /rests/1?p1=1&p2=Hello

actionOptions()

actionOptions() 

OPTIONS /rests | /rests/1

actionUpdate()

actionUpdate() 

PUT|PATCH /rests/1 x-www-form-urlencoded [ 'p1' => 1, 'p2' => 'Hello', ]

actionDelete()

actionDelete() 

DELETE /rests/1