为 zf2 实现密码验证器 [英] Implementing a password validator for zf2
本文介绍了为 zf2 实现密码验证器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编写验证两个输入的密码验证器的好方法是什么(必须是 eqeal)以及如何将其集成到 zf2 表单中.
What is a good approach to write a password validator that validates two inputs (must be eqeal) and how would you integrate that into a zf2 form.
推荐答案
有一个Identical"验证器可以检查两个字段是否相等,它可以在表单构造函数中以如下方式使用:
There is an "Identical" validator that check two fields to be equal, it can be used in the following way in form constructor:
$this->add(array(
'name' => 'password', // add first password field
/* ... other params ... */
));
$this->add(array(
'name' => 'passwordCheck', // add second password field
/* ... other params ... */
'validators' => array(
array(
'name' => 'Identical',
'options' => array(
'token' => 'password', // name of first password field
),
),
),
));
这篇关于为 zf2 实现密码验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文