我有以下输入过滤器与验证一起使用,但 StringToLower 过滤器不起作用。有人知道这是如何工作的吗?Zend2 文档在我使用的编码方法中没有任何示例。
$this->add(array(
'name' => 'cemail',
'required' => true,
'filters' => array(
array(
'name' => 'string_to_lower',
),
array(
'name' => 'StringTrim',
),
),
'validators' => array(
array(
'name' => 'NotEmpty',
'break_chain_on_failure' => true,
'options' => array(
'messages' => array(
'isEmpty' => 'Email address is required'
),
),
),
array(
'name' => 'EmailAddress',
'break_chain_on_failure' => true,
'options' => array(
'hostname' => true,
'messages' => array(
'hostnameInvalid' => 'Invalid email address provided.',
),
),
),
array(
'name' => 'string_length',
'options' => array(
'encoding' => 'UTF-8',
'min' => 5,
'max' => 150,
'messages' => array(
'stringLengthTooLong' => 'Email address must not exceed 150 characters',
'stringLengthTooShort' => 'Email address must contain at least 5 characters',
),
),
),
),
));