DataFilter
    
            
            in package
            
        
    
    
    
        
            Class DataFilter
Table of Contents
- $code : int
- 验证失败时返回的code
- $ctx : mixed
- 待验证字符串
- $msg : string
- $userState : bool
- 用户指定状态
- __construct() : mixed
- InputFilter constructor.
- __toString() : mixed
- toString
- account() : array<string|int, mixed>|mixed
- 字母数字或下划线
- all() : mixed
- 通过所有验证方法
- alpha() : mixed
- 验证字母
- any() : mixed
- 满足任意规则
- array() : array<string|int, mixed>|mixed
- 数组
- chinese() : mixed
- 中文
- closure() : mixed
- 自定义函数验证
- date() : false|string
- 验证日期
- default() : mixed
- 默认值
- email() : mixed
- 验证email
- filter() : mixed
- fixed() : mixed
- 限定值
- float() : mixed
- 浮点数
- id() : int
- 大于0的正整数
- idCard() : mixed
- 验证身份证
- int() : int
- 整型
- json() : array<string|int, mixed>|mixed|string
- json
- length() : string
- 限定参数长度(支持中文)
- mobile() : array<string|int, mixed>|mixed|string
- 手机号
- msg() : $this
- 自定义验证失败时的消息
- range() : int|null
- 限定范围
- raw() : mixed
- 获取原始入参
- regx() : mixed
- 正则匹配
- rule() : mixed
- 规则验证
- switch() : mixed
- 限定值中的一个或者第一个值
- throwMsg() : mixed
- 抛出异常信息
- uInt() : mixed
- 正整数
- uploader() : array<string|int, mixed>
- 上传验证
- url() : string|void
- 是否是一个绝对路径
- val() : string
- 转义后的原始参数
Properties
$code
验证失败时返回的code
    protected
        int
    $code
     = 0
        
    
$ctx
待验证字符串
    protected
        mixed
    $ctx
    
        
    
$msg
    protected
        string
    $msg
    
        
    
$userState
用户指定状态
    protected
        bool
    $userState
     = false
        
    
Methods
__construct()
InputFilter constructor.
    public
                __construct(mixed $ctx) : mixed
        
        Parameters
- $ctx : mixed
Return values
mixed —__toString()
toString
    public
                __toString() : mixed
        
    
    
        Return values
mixed —account()
字母数字或下划线
    public
                account([int $min = 2 ][, int $max = 12 ]) : array<string|int, mixed>|mixed
        
        Parameters
- $min : int = 2
- 
                    最小长度 
- $max : int = 12
- 
                    最大长度 
Tags
Return values
array<string|int, mixed>|mixed —all()
通过所有验证方法
    public
                all(array<string|int, mixed> ...$handler) : mixed
        
        Parameters
- $handler : array<string|int, mixed>
- 
                    方法名:参数1,参数2 
Tags
Return values
mixed —alpha()
验证字母
    public
                alpha() : mixed
        
    
    
    Tags
Return values
mixed —any()
满足任意规则
    public
                any(mixed ...$handler) : mixed
        
        Parameters
- $handler : mixed
- 
                    方法名:参数1,参数2 
Tags
Return values
mixed —array()
数组
    public
                array([mixed $delimiter = null ]) : array<string|int, mixed>|mixed
        
        Parameters
- $delimiter : mixed = null
- 
                    分隔符 
Tags
Return values
array<string|int, mixed>|mixed —chinese()
中文
    public
                chinese() : mixed
        
    
    
    Tags
Return values
mixed —closure()
自定义函数验证
    public
                closure(Closure $handler) : mixed
        
        Parameters
- $handler : Closure
Tags
Return values
mixed —date()
验证日期
    public
                date([null &$unixTime = null ]) : false|string
        
        Parameters
- $unixTime : null = null
Tags
Return values
false|string —default()
默认值
    public
                default(mixed $val) : mixed
        
        Parameters
- $val : mixed
Return values
mixed —email()
验证email
    public
                email([string $addValidExpr = "/^[a-zA-Z0-9]([\w\-\.]?)+/" ]) : mixed
        
        Parameters
- $addValidExpr : string = "/^[a-zA-Z0-9]([\w\-\.]?)+/"
Tags
Return values
mixed —filter()
    public
                filter([int $filter = FILTER_DEFAULT ][, null $options = null ]) : mixed
        
        Parameters
- $filter : int = FILTER_DEFAULT
- $options : null = null
Tags
Return values
mixed —fixed()
限定值
    public
                fixed(array<string|int, mixed> ...$val) : mixed
        
        Parameters
- $val : array<string|int, mixed>
Tags
Return values
mixed —float()
浮点数
    public
                float() : mixed
        
    
    
    Tags
Return values
mixed —id()
大于0的正整数
    public
                id() : int
        
    
    
    Tags
Return values
int —idCard()
验证身份证
    public
                idCard([bool $justCheckLength = false ]) : mixed
        
        Parameters
- $justCheckLength : bool = false
Tags
Return values
mixed —int()
整型
    public
                int() : int
        
    
    
    Tags
Return values
int —json()
json
    public
                json([bool $array = true ][, int $depth = 128 ], int $options) : array<string|int, mixed>|mixed|string
        
        Parameters
- $array : bool = true
- $depth : int = 128
- $options : int
Tags
Return values
array<string|int, mixed>|mixed|string —length()
限定参数长度(支持中文)
    public
                length(int $min, int $max) : string
        
        Parameters
- $min : int
- $max : int
Tags
Return values
string —mobile()
手机号
    public
                mobile() : array<string|int, mixed>|mixed|string
        
    
    
    Tags
Return values
array<string|int, mixed>|mixed|string —msg()
自定义验证失败时的消息
    public
                msg(int $code[, string|null $msg = null ]) : $this
        
        Parameters
- $code : int
- $msg : string|null = null
Return values
$this —range()
限定范围
    public
                range(int $min, int $max) : int|null
        
        Parameters
- $min : int
- $max : int
Tags
Return values
int|null —raw()
获取原始入参
    public
                raw() : mixed
        
    
    
        Return values
mixed —regx()
正则匹配
    public
                regx(string $pattern[, string|null $msg = null ]) : mixed
        
        Parameters
- $pattern : string
- $msg : string|null = null
Tags
Return values
mixed —rule()
规则验证
    public
                rule(string $name[, mixed &$val = null ]) : mixed
        
        Parameters
- $name : string
- $val : mixed = null
Tags
Return values
mixed —switch()
限定值中的一个或者第一个值
    public
                switch(mixed ...$values) : mixed
        宽松版的fixed, 类似switch语法
Parameters
- $values : mixed
Return values
mixed —throwMsg()
抛出异常信息
    public
                throwMsg(null $msg, mixed ...$params) : mixed
        
        Parameters
- $msg : null
- $params : mixed
Tags
Return values
mixed —uInt()
正整数
    public
                uInt() : mixed
        
    
    
    Tags
Return values
mixed —uploader()
上传验证
    public
                uploader(Uploader $uploader) : array<string|int, mixed>
        
        Parameters
- $uploader : Uploader
Tags
Return values
array<string|int, mixed> —url()
是否是一个绝对路径
    public
                url() : string|void
        
    
    
    Tags
Return values
string|void —val()
转义后的原始参数
    public
                val([bool $stripTags = true ]) : string
        
        Parameters
- $stripTags : bool = true