Aba*_*dis 3 php validation zend-framework
我使用zend框架和zend形式与验证器DIGIT
这样:
$ZV_Digit=new Zend_Validate_Digits();
$credit = new Zend_Form_Element_Text('credit');
$credit->setLabel('current credit');
$credit->setValidators(array($ZV_Digit));
Run Code Online (Sandbox Code Playgroud)
但它没有传递负数并给出了这个错误:
'-4000' contains not only digit characters
Run Code Online (Sandbox Code Playgroud)
我现在能做什么?
来自Zend Framework 文档
Note: Validating numbers
When you want to validate numbers or numeric values,
be aware that this validator only validates digits.
This means that any other sign like a thousand separator
or a comma will not pass this validator.
In this case you should use Zend_Validate_Int or Zend_Validate_Float
Run Code Online (Sandbox Code Playgroud)