CrossPHP

Rules
in package

验证规则

Class Rules

Table of Contents

$instance  : mixed
$rules  : mixed
addRule()  : string
添加规则
getRules()  : array<string|int, mixed>
获取所有规则
has()  : mixed
rule是否存在
match()  : mixed
匹配
__construct()  : mixed
Rules constructor.
instance()  : Rules

Properties

$instance

protected static mixed $instance

$rules

protected mixed $rules = []

Methods

addRule()

添加规则

public static addRule(string $name, mixed $rule) : string
Parameters
$name : string
$rule : mixed
Return values
string

getRules()

获取所有规则

public static getRules() : array<string|int, mixed>
Return values
array<string|int, mixed>

has()

rule是否存在

public static has(string $name) : mixed
Parameters
$name : string
Return values
mixed

match()

匹配

public static match(string $name, mixed $content) : mixed
Parameters
$name : string
$content : mixed
Tags
throws
CoreException
Return values
mixed

__construct()

Rules constructor.

protected __construct() : mixed
Return values
mixed

Search results