<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 內置驗證器 > `/`分隔的驗證器,表明功能是一樣的,只是有不同的別名 | 驗證器 | 說明 | 規則示例 | | --- | --- | --- | | `required` | 要求此字段/屬性是必須的(不為空的)。[關于為空](https://github.com/inhere/php-validate#about-empty-value) | `['tagId, userId', 'required' ]` | | `int/integer` | 驗證是否是 int**支持范圍檢查** | `['userId', 'int']``['userId', 'int', 'min'=>4, 'max'=>16]` | | `num/number` | 驗證是否是 number(大于0的整數)**支持范圍檢查** | `['userId', 'number']``['userId', 'number', 'min'=>4, 'max'=>16]` | | `bool/boolean` | 驗證是否是 bool.[關于bool值](https://github.com/inhere/php-validate#about-bool-value) | `['open', 'bool']` | | `float` | 驗證是否是 float | `['price', 'float']` | | `string` | 驗證是否是 string.**支持長度檢查** | `['name', 'string']`,`['name', 'string', 'min'=>4, 'max'=>16]` | | `accepted` | 驗證的字段必須為`yes/on/1/true`這在確認「服務條款」是否同意時有用(ref laravel) | `['agree', 'accepted']` | | `url` | 驗證是否是 url | `['myUrl', 'url']` | | `email` | 驗證是否是 email | `['userEmail', 'email']` | | `alpha` | 驗證值是否僅包含字母字符 | `['name', 'alpha']` | | `alphaNum` | 驗證是否僅包含字母、數字 | `['field', 'alphaNum']` | | `alphaDash` | 驗證是否僅包含字母、數字、破折號( - )以及下劃線( \_ ) | `['field', 'alphaDash']` | | `map/isMap` | 驗證值是否是一個非自然數組 map (key - value 形式的) | `['goods', 'isMap']` | | `list/isList` | 驗證值是否是一個自然數組 list (key是從0自然增長的) | `['tags', 'isList']` | | `array/isArray` | 驗證是否是數組 | `['goods', 'isArray']` | | `each` | 對數組中的每個值都應用**給定的驗證器**(這里的絕大多數驗證器都可以使用),并且要**全部通過** | `['goods.*','each','string']`,`['goods.*','each','string','min'=>3]` | | `hasKey` | 驗證數組存在給定的key(s) | `['goods', 'hasKey', 'pear']``['goods', 'hasKey', ['pear', 'banana']]` | | `distinct` | 數組中的值必須是唯一的 | `['goods', 'distinct']`,`['users.*.id', 'distinct']` | | `ints/intList` | 驗證字段值是否是一個 int list | `['tagIds', 'intList']` | | `numList` | 驗證字段值是否是一個 number list | `['tagIds', 'numList']` | | `strings/strList` | 驗證字段值是否是一個 string list | `['tags', 'strList']` | | `arrList` | 驗證字段值是否是一個 array list(多維數組) | `['tags', 'arrList']` | | `min` | 最小邊界值驗證 | `['title', 'min', 40]` | | `max` | 最大邊界值驗證 | `['title', 'max', 40]` | | `size/range/between` | 驗證大小范圍, 可以支持驗證`int`,`string`,`array`數據類型 | `['tagId', 'size', 'min'=>4, 'max'=>567]` | | `length` | 長度驗證( 跟`size`差不多, 但只能驗證`string`,`array`的長度 | `['username', 'length', 'min' => 5, 'max' => 20]` | | `fixedSize/sizeEq/lengthEq` | 固定的長度/大小(驗證`string`,`array`長度,`int`大小) | `['field', 'fixedSize', 12]` | | `startWith` | 值(`string/array`)是以給定的字符串開始 | `['field', 'startWith', 'hell']` | | `endWith` | 值(`string/array`)是以給定的字符串結尾 | `['field', 'endWith', 'world']` | | `in/enum` | 枚舉驗證: 包含 | `['status', 'in', [1,2,3]]` | | `notIn` | 枚舉驗證: 不包含 | `['status', 'notIn', [4,5,6]]` | | `inField` | 枚舉驗證: 字段值 存在于 另一個字段(anotherField)的值中 | `['field', 'inField', 'anotherField']` | | `eq/mustBe` | 必須是等于給定值 | `['status', 'mustBe', 1]` | | `ne/neq/notBe` | 不能等于給定值 | `['status', 'notBe', 0]` | | `eqField` | 字段值比較: 相同 | `['passwd', 'eqField', 'repasswd']` | | `neqField` | 字段值比較: 不能相同 | `['userId', 'neqField', 'targetId']` | | `ltField` | 字段值比較: 小于 | `['field1', 'ltField', 'field2']` | | `lteField` | 字段值比較: 小于等于 | `['field1', 'lteField', 'field2']` | | `gtField` | 字段值比較: 大于 | `['field1', 'gtField', 'field2']` | | `gteField` | 字段值比較: 大于等于 | `['field1', 'gteField', 'field2']` | | `requiredIf` | 指定的其它字段( anotherField )值等于任何一個`value`時,此字段為**必填**(ref laravel) | `['city', 'requiredIf', 'myCity', ['chengdu'] ]` | | `requiredUnless` | 指定的其它字段( anotherField )值等于任何一個`value`時,此字段為**不必填**(ref laravel) | `['city', 'requiredUnless', 'myCity', ['chengdu'] ]` | | `requiredWith` | 指定的字段中的*任意一個*有值且不為空,則此字段為**必填**(ref laravel) | `['city', 'requiredWith', ['myCity'] ]` | | `requiredWithAll` | 如果指定的*所有字段*都有值,則此字段為**必填**(ref laravel) | `['city', 'requiredWithAll', ['myCity', 'myCity1'] ]` | | `requiredWithout` | 如果缺少*任意一個*指定的字段值,則此字段為**必填**(ref laravel) | `['city', 'requiredWithout', ['myCity', 'myCity1'] ]` | | `requiredWithoutAll` | 如果所有指定的字段**都沒有值**,則此字段為**必填**(ref laravel) | `['city', 'requiredWithoutAll', ['myCity', 'myCity1'] ]` | | `date` | 驗證是否是 date | `['publishedAt', 'date']` | | `dateFormat` | 驗證是否是 date, 并且是指定的格式 | `['publishedAt', 'dateFormat', 'Y-m-d']` | | `dateEquals` | 驗證是否是 date, 并且是否是等于給定日期 | `['publishedAt', 'dateEquals', '2017-05-12']` | | `beforeDate` | 驗證字段值必須是給定日期之前的值(ref laravel) | `['publishedAt', 'beforeDate', '2017-05-12']` | | `beforeOrEqualDate` | 字段值必須是小于或等于給定日期的值(ref laravel) | `['publishedAt', 'beforeOrEqualDate', '2017-05-12']` | | `afterOrEqualDate` | 字段值必須是大于或等于給定日期的值(ref laravel) | `['publishedAt', 'afterOrEqualDate', '2017-05-12']` | | `afterDate` | 驗證字段值必須是給定日期之前的值 | `['publishedAt', 'afterDate', '2017-05-12']` | | `json` | 驗證是否是json字符串(默認嚴格驗證,必須以`{``[`開始) | `['goods', 'json']``['somedata', 'json', false]`\- 非嚴格,普通字符串`eg 'test'`也會通過 | | `file` | 驗證是否是上傳的文件 | `['upFile', 'file']` | | `image` | 驗證是否是上傳的圖片文件 | `['avatar', 'image']`, 限定后綴名`['avatar', 'image', 'jpg,png']` | | `ip` | 驗證是否是 IP | `['ipAddr', 'ip']` | | `ipv4` | 驗證是否是 IPv4 | `['ipAddr', 'ipv4']` | | `ipv6` | 驗證是否是 IPv6 | `['ipAddr', 'ipv6']` | | `macAddress` | 驗證是否是 mac Address | `['field', 'macAddress']` | | `md5` | 驗證是否是 md5 格式的字符串 | `['passwd', 'md5']` | | `sha1` | 驗證是否是 sha1 格式的字符串 | `['passwd', 'sha1']` | | `color` | 驗證是否是html color | `['backgroundColor', 'color']` | | `regex/regexp` | 使用正則進行驗證 | `['name', 'regexp', '/^\w+$/']` | | `safe` | 用于標記字段是安全的,無需驗證 | `['createdAt, updatedAt', 'safe']` | ### [](https://github.com/inhere/php-validate#safe-%E9%AA%8C%E8%AF%81%E5%99%A8%E6%A0%87%E8%AE%B0%E5%B1%9E%E6%80%A7%E5%AD%97%E6%AE%B5%E6%98%AF%E5%AE%89%E5%85%A8%E7%9A%84)`safe`驗證器,標記屬性/字段是安全的 特殊驗證器 用于標記字段是安全的,無需驗證,直接加入到安全數據中。 比如我們在寫入數據庫之前手動追加的字段: 創建時間,更新時間。 ~~~html ['createdAt, updatedAt', 'safe'] ~~~ ### [](https://github.com/inhere/php-validate#%E4%B8%80%E4%BA%9B%E8%A1%A5%E5%85%85%E8%AF%B4%E6%98%8E)一些補充說明
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看