php – Laravel规则验证数字

前端之家收集整理的这篇文章主要介绍了php – Laravel规则验证数字前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有以下规则:
'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.

原文链接:https://www.f2er.com/laravel/130778.html

猜你在找的Laravel相关文章