@@ -495,6 +495,7 @@ $v = Validation::make($_POST,[
495495-------|-------------|------------
496496` abs ` | 返回绝对值 | ` ['field', 'int', 'filter' => 'abs'], `
497497` int/integer ` | 过滤非法字符并转换为` int ` 类型 ** 支持数组** | ` ['userId', 'number', 'filter' => 'int'], `
498+ ` bool/boolean ` | 转换为 ` bool ` [ 关于bool值] ( #about-bool-value ) | ` ['argee', 'bool'] `
498499` float ` | 过滤非法字符,保留` float ` 格式的数据 | ` ['price', 'float', 'filter' => 'float'], `
499500` string ` | 过滤非法字符并转换为` string ` 类型 | ` ['userId', 'number', 'filter' => 'string'], `
500501` trim ` | 去除首尾空白字符,支持数组。 | ` ['username', 'min', 4, 'filter' => 'trim'], `
@@ -547,8 +548,9 @@ $v = Validation::make($_POST,[
547548` fixedSize/sizeEq/lengthEq ` | 固定的长度/大小(验证 ` string ` , ` array ` 长度, ` int ` 大小) | ` ['field', 'fixedSize', 12] `
548549` startWith ` | 值(` string/array ` )是以给定的字符串开始 | ` ['field', 'startWith', 'hell'] `
549550` endWith ` | 值(` string/array ` )是以给定的字符串结尾 | ` ['field', 'endWith', 'world'] `
550- ` in/enum ` | 枚举验证包含 | ` ['status', 'in', [1,2,3]] `
551- ` notIn ` | 枚举验证不包含 | ` ['status', 'notIn', [4,5,6]] `
551+ ` in/enum ` | 枚举验证: 包含 | ` ['status', 'in', [1,2,3]] `
552+ ` notIn ` | 枚举验证: 不包含 | ` ['status', 'notIn', [4,5,6]] `
553+ ` inField ` | 枚举验证: 字段值 存在于 另一个字段(anotherField)的值中 | ` ['field', 'inField', 'anotherField'] `
552554` mustBe ` | 必须是等于给定值 | ` ['status', 'mustBe', 1] `
553555` notBe ` | 不能等于给定值 | ` ['status', 'notBe', 0] `
554556` compare/same/equal ` | 字段值相同比较 | ` ['passwd', 'compare', 'repasswd'] `
@@ -609,11 +611,13 @@ $v = Validation::make($_POST, [
609611- ** 请将 ` required* ` 系列规则写在规则列表的最前面**
610612- 关于为空判断:字段符合下方任一条件时即为「空」<a name =" about-empty-value " ></a >
611613 - 该值为 ` null ` .
612- - 该值为空字符串
613- - 该值为空数组
614- - 关于布尔值验证<a name =" about-bool-value " ></a >
615- * 如果是 "1"、"true"、"on" 和 "yes",则返回 ` TRUE `
616- * 如果是 "0"、"false"、"off"、"no" 和 "",则返回 ` FALSE `
614+ - 该值为空字符串 ` '' `
615+ - 该值为空数组 ` [] `
616+ - 该值为空对象 -- 空的 ` 可数 ` 对象
617+ - 该值为没有路径的上传文件
618+ - 关于布尔值: 值符合下列的任意一项即认为是为bool值<a name =" about-bool-value " ></a >
619+ - 是 "1"、"true"、"on" 和 "yes" (` TRUE ` )
620+ - 是 "0"、"false"、"off"、"no" 和 "" (` FALSE ` )
617621- ` size/range ` ` length ` 可以只定义 ` min ` 或者 ` max ` 值
618622- 支持对数组的子级值验证
619623
@@ -695,9 +699,9 @@ public function getErrors(): array
695699
696700``` php
697701[
698- [ attr1 => 'error message 1' ],
699- [ attr1 => 'error message 2' ],
700- [ attr2 => 'error message 3'],
702+ ['name' => 'field1', 'msg' => 'error Message1' ],
703+ ['name' => 'field2', 'msg' => 'error Message2' ],
704+ ...
701705]
702706```
703707
0 commit comments