如何扩展以下zend验证器以包含带有逗号和点分隔符的数字。例: 1.234.567,89
return array(
"*" => array("allowEmpty" => true),
"pret" => array(
"digits",
"presence" => "required"
),
);发布于 2013-12-04 11:35:41
您可以在InputFilter函数中添加此验证器:
array(
'name' => 'Regex',
'options' => array(
'pattern' => '/^[0-9_\.\,]*$/',
'messages' => array(
\Zend\Validator\Regex::INVALID => 'Your error message.',
),
),
),您可以添加您的字符需要接受您的输入模式(正则表达式)。
我希望这能帮到你。
https://stackoverflow.com/questions/19635984
复制相似问题