我在 Kohana 3.1 中添加过滤器时遇到问题
我在 Kohana 3.1 中添加回调过滤器时遇到一些问题。
这是我的验证器:
Validation::factory($fields)
->rules('username', $this->_rules['username'])
->rule('username', 'username_available', array($this, ':field'))
->rules('email', $this->_rules['email'])
->rule('email', 'email_available', array($this, ':field'))
->rules('password', $this->_rules['password'])
->rules('password_confirm', $this->_rules['password_confirm'])
->filter('password', $this->_filters['password']);
这是过滤器的数组:
protected $_filters = array(
'password' => array(
'Auth::instance' => 'hash'
)
);
它曾经看起来像这样:
public function filters()
{
return array(
'password' => array(
array(array(Auth::instance(), 'hash'))
)
);
}
提前感谢您的帮助!
I am having some problems adding a callback filter in Kohana 3.1.
Here is my validator:
Validation::factory($fields)
->rules('username', $this->_rules['username'])
->rule('username', 'username_available', array($this, ':field'))
->rules('email', $this->_rules['email'])
->rule('email', 'email_available', array($this, ':field'))
->rules('password', $this->_rules['password'])
->rules('password_confirm', $this->_rules['password_confirm'])
->filter('password', $this->_filters['password']);
Here is the array for the filter:
protected $_filters = array(
'password' => array(
'Auth::instance' => 'hash'
)
);
It used to look like this:
public function filters()
{
return array(
'password' => array(
array(array(Auth::instance(), 'hash'))
)
);
}
Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Kohana 3.1+ 中的验证不支持过滤器,它只是 ORM 功能。
Validation in Kohana 3.1+ doesn't support filters, it's ORM-only feature.