Properties

$__useCount

$__useCount : integer

Type

integer — 作用计数

$__genTime

$__genTime : integer

Type

integer — 创建时间

$__isContruct

$__isContruct : boolean

Type

boolean — 是否执行构造方法

$stdClass

$stdClass : \stdClass|null

Type

\stdClass|null — 对象模板

$request

$request : \swoole_http_request|\PG\MSF\Console\Request

Type

\swoole_http_request|\PG\MSF\Console\Request — 请求参数对象

$__serializeRequest

$__serializeRequest : \swoole_http_request

Type

\swoole_http_request — 用于自动序列化(解决序列化资源被析构的问题)

$__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() 

构造方法

__sleep()

__sleep() : array

属性用于序列化

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

destroy()

destroy() 

销毁,解除引用

isUse()

isUse() 

对象已使用标识

getIsDestroy()

getIsDestroy() : boolean

是否已经执行destroy

Returns

boolean

setContext()

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

设置上下文

Parameters

\PG\MSF\Helpers\Context $context

请求上下文对象

Returns

$this

__wakeup()

__wakeup() 

反序列化后的初始化操作

set()

set(\swoole_http_request|\PG\MSF\Console\Request  $request) : $this

设置请求参数对象

Parameters

\swoole_http_request|\PG\MSF\Console\Request $request

请求参数对象

Returns

$this

reset()

reset() : $this

重置请求参数对象

Returns

$this

postGet()

postGet(string  $index) : string

获取POST/GET参数,优先读取POST

Parameters

string $index

请求参数名

Returns

string

post()

post(string  $index) : string

获取POST参数

Parameters

string $index

POST参数名

Returns

string

get()

get(string  $index) : string

获取GET参数

Parameters

string $index

GET参数名

Returns

string

getPost()

getPost(string  $index) : string

获取POST/GET参数,优先读取GET

Parameters

string $index

请求参数名

Returns

string

getAllPostGet()

getAllPostGet() : array

先获取所有的POST参数,如果POST为空则获取所有的Get参数

Returns

array

getAllPost()

getAllPost() : array

获取所有的POST参数

Returns

array

getAllGet()

getAllGet() : array

获取所有的GET参数

Returns

array

getAllHeader()

getAllHeader() : array

获取请求的所有报头

Returns

array

getAllServer()

getAllServer() : array

获取处理请求的Server信息

Returns

array

getRawContent()

getRawContent() : string

获取原始的POST包体

Returns

string

setPost()

setPost(string  $key, mixed  $value) : $this

设置POST请求参数

Parameters

string $key

设置参数的key

mixed $value

设置参数的value

Returns

$this

setGet()

setGet(string  $key, mixed  $value) : $this

设置GET请求参数

Parameters

string $key

设置参数的key

mixed $value

设置参数的value

Returns

$this

setAllPost()

setAllPost(array  $post) : $this

设置所有POST请求参数

Parameters

array $post

所有的待设置的POST请求参数

Returns

$this

setAllGet()

setAllGet(array  $get) : $this

设置所有GET请求参数

Parameters

array $get

所有的待设置的GET请求参数

Returns

$this

getCookie()

getCookie(string  $index) : string

获取Cookie参数

Parameters

string $index

Cookie参数名

Returns

string

getFile()

getFile(string  $index) : array

获取上传文件信息

Parameters

string $index

File文件名

Returns

array

getServer()

getServer(string  $index) : array|boolean|string

获取Server相关的数据

Parameters

string $index

获取的Server参数名

Returns

array|boolean|string

getRequestMethod()

getRequestMethod() : string

获取请求的方法

Returns

string

getRequestUri()

getRequestUri() : string

获取请求的URI

Returns

string

getPathInfo()

getPathInfo() : string

获取请求的PATH

Returns

string

getRemoteAddr()

getRemoteAddr() : string

获取请求的用户ID

Returns

string

getHeader()

getHeader(string  $index) : string

获取请求报头参数

Parameters

string $index

请求报头参数名

Returns

string