between 与 size, 在不同的数据类型有不同的检验方式。
'between' => ['numeric' => ':attribute 必须介于 :min - :max 之间。',
'file' => ':attribute 必须介于 :min - :max kb 之间。',
'string' => ':attribute 必须介于 :min - :max 个字符之间。',
'array' => ':attribute 必须只有 :min - :max 个单元。',
],
'size' => ['numeric' => ':attribute 大小必须为 :size。',
'file' => ':attribute 大小必须为 :size kb。',
'string' => ':attribute 必须是 :size 个字符。',
'array' => ':attribute 必须为 :size 个单元。',
],
fail ( 检验字符串长度)
$validator = \Validator::make (['title'=>"4"
], ['title' => 'required|string|between:3,10',
]);
$validator = \Validator::make (['title'=>"4589"
], ['title' => 'required|numeric|between:3,10',
]);
ok ( 检验字符串长度)
$validator = \Validator::make (['title'=>"4589"
], ['title' => 'required|string|between:3,10',
]);