RequestMapping
in package
Class RequestMapping
Table of Contents
- $instance : self
- $mapping : array<string|int, mixed>
- $matchString : string
- $rules : array<string|int, mixed>
- addRequestRouter() : bool
- 添加HTTP路由
- addRouter() : bool
- 添加路由(按当前请求类型分组,等同于Any)
- addRule() : static
- 添加验证规则
- getInstance() : static
- match() : bool
- setRules() : void
- 设置验证规则
- __construct() : mixed
- RequestMapping constructor.
- addToMapping() : bool
- 构造mapping
- matchCustomRouter() : bool
- 匹配uri和自定义路由
- matchProcess() : bool
- 循环匹配(参数多的优先)
Properties
$instance
protected
static self
$instance
$mapping
protected
array<string|int, mixed>
$mapping
= []
$matchString
protected
string
$matchString
$rules
protected
array<string|int, mixed>
$rules
= []
Methods
addRequestRouter()
添加HTTP路由
public
addRequestRouter(string $requestType, string $router[, mixed $handler = null ]) : bool
Parameters
- $requestType : string
- $router : string
- $handler : mixed = null
Tags
Return values
bool —addRouter()
添加路由(按当前请求类型分组,等同于Any)
public
static addRouter(mixed $router[, mixed $handler = null ]) : bool
Parameters
- $router : mixed
- $handler : mixed = null
Tags
Return values
bool —addRule()
添加验证规则
public
addRule(string $params, string $pattern) : static
Parameters
- $params : string
- $pattern : string
Return values
static —getInstance()
public
static getInstance() : static
Return values
static —match()
public
match(string $request[, mixed &$handle = null ][, array<string|int, mixed> &$params = [] ]) : bool
Parameters
- $request : string
- $handle : mixed = null
- $params : array<string|int, mixed> = []
Return values
bool —setRules()
设置验证规则
public
setRules(array<string|int, mixed> $rules) : void
Parameters
- $rules : array<string|int, mixed>
Return values
void —__construct()
RequestMapping constructor.
private
__construct() : mixed
Return values
mixed —addToMapping()
构造mapping
private
addToMapping(string $groupKey, string $customRouter[, null $handler = null ]) : bool
Parameters
- $groupKey : string
-
分组名称
- $customRouter : string
- $handler : null = null
Tags
Return values
bool —matchCustomRouter()
匹配uri和自定义路由
private
matchCustomRouter(string $customRouter[, array<string|int, mixed> $paramsKeys = [] ][, array<string|int, mixed> &$params = [] ]) : bool
Parameters
- $customRouter : string
- $paramsKeys : array<string|int, mixed> = []
- $params : array<string|int, mixed> = []
Return values
bool —matchProcess()
循环匹配(参数多的优先)
private
matchProcess(array<string|int, mixed> $routers, mixed &$handle, array<string|int, mixed> &$params) : bool
Parameters
- $routers : array<string|int, mixed>
- $handle : mixed
- $params : array<string|int, mixed>