我正在编写一个简单的登录表单,一切正常(验证等),但我无法获取值,这是我的代码:
public function executeIndex(sfWebRequest $request)
{
$this->getUser()->clearCredentials();
$this->getUser()->setAuthenticated(false);
$this->form = new LoginForm();
if ($request->isMethod('post') && $request->hasParameter('login')) {
$this->form->bind($request->getParameter('login'));
if ($this->form->isValid()) {
$this->getUser()->setAuthenticated(true);
$this->getUser()->addCredential('user');
$this->login = $this->form->getValue('login');
}
}
}
$this->login 为 NULL。现在我检查了几乎所有内容,表单有效,isBound() 为 true,count() 返回 3,我可以看到请求中的值:
parameterHolder:
action: index
login: { login: foo, password: foo, _csrf_token: 53ebddee1883d7e3d6575d6fb1707a15 }
module: login
但是 getValues() 返回 NULL,getValue('login') 等也返回 NULL。怎么会这样?
不,我不想使用 sfGuard-Plugins ;)
尝试这样的事情怎么样
$form['value_name']->getValue()
仍然是NULL吗?
您是否还可以创建自定义帖子验证器?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)