我使用 Zend\InputFilter\InputFilter 类进行表单验证。点字段应该只接受 1 到 5 之间的整数。但它不能正常工作,它接受以 1 到 5 之间的整数开头的字符串。例如 1kjhkjh、2tgfjhgfjhf、4jhkljg... 我的代码有什么问题?
$inputFilter->add (
$inputFilter->getFactory()->createInput (
array (
'name' => 'point',
'required' => true,
'validators' => array (
array(
'name' => 'Digits'),
array (
'name' => 'Between',
'options' => array (
'min' => 1,
'max' => 5,
'messages' => array('notBetween' => 'Point must be between %min% and %max%')
)
)
)
)
)
);