加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

php – Laravel规则验证数字

发布时间:2020-12-14 19:50:35 所属栏目:大数据 来源:网络整理
导读:我有以下规则: 'Fno' = 'digits:10''Lno' = 'min:2|max5' // this seems invalid 但如何有规则 Fno应该是一个数字,最少2位到最多5位数 Lno应该是一个只有最小2位数字的数字 如果我正确地得到你想要的: $rules = ['Fno' = 'digits_between:2,5','Lno' = 'nu
我有以下规则:
'Fno' => 'digits:10'
'Lno' => 'min:2|max5'  // this seems invalid

但如何有规则

Fno应该是一个数字,最少2位到最多5位数

Lno应该是一个只有最小2位数字的数字

如果我正确地得到你想要的:
$rules = ['Fno' => 'digits_between:2,5','Lno' => 'numeric|min:2'];

要么

$rules = ['Fno' => 'numeric|min:2|max:5','Lno' => 'numeric|min:2'];

对于所有可用的规则:http://laravel.com/docs/4.2/validation#available-validation-rules

digits_between :min,max

The field under validation must have a length between the given min
and max.

numeric

The field under validation must have a numeric value.

max:value

The field under validation must be less than or equal to a maximum
value. Strings,numerics,and files are evaluated in the same fashion
as the size rule.

min:value

The field under validation must have a minimum value. Strings,and files are evaluated in the same fashion as the size rule.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读