如何排除您在 $_POST 中收到的数据?此表单用于修改用户数据: 该表单必须验证该电子邮件不存在,属于她,该电子邮件已被记录:
public function __construct(Adapter $adapter)
{
$no_record_exists = new NoRecordExists(array(
'table' => 'user',
'field' => 'email',
'adapter' => $adapter,
'exclude' => array(
'field' => 'email',
'value' => '$_POST['email']'
)
));
$this->add(array(
'name' => 'email',
'required' => true,
'filters' => array(
array(
'name' => 'StripTags'
),
array(
'name' => 'StringTrim'
)
),
'validators' => array(
$no_record_exists,
array(
'name' => 'EmailAddress',
'options' => array(
'encoding' => 'UTF-8',
'min' => 5,
'max' => 48
)
),
)
));
}
}