更新时间:2023-09-11 11:51:28
我会设置 array('min' => ($value-1))
并使用 GreaterThan代码>.也许使用一个链并添加
Digits
,这样你就可以确保你正在处理数字.像这样:
I'd set array('min' => ($value-1))
and use GreaterThan
. Maybe use a chain and add Digits
, so you make sure you're dealing with numbers. Something like this:
$value = 10;
$chain = new Zend_Validate();
$chain->addValidator(new Zend_Validate_Digits());
$chain->addValidator(new Zend_Validate_GreaterThan(array('min' => ($value-1))));
var_dump($chain->isValid($value), $chain->getMessages());
我认为这就是采埃孚所能做到的.不过,获得功能请求也无妨.将是一个不错的补充.否则,扩展 GreaterThan
并添加一个选项.
I think that's as far as you get with ZF. Wouldn't hurt to get a feature request though. Would be a nice addition. Otherwise, extend GreaterThan
and add an option.