我是codeIgniter的新手,我刚刚陷入困境.我正在使用HMVC扩展,并在验证时收到以下错误:
无法访问与您的字段名称密码对应的错误消息.(pword_check)
任何帮助将不胜感激
码:
public function submit()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required|max_length[30]|xss_clean');
$this->form_validation->set_rules('pword', 'Password', 'required|max_length[30]|callback_pword_check|xss_clean');
if ($this->form_validation->run() == FALSE)
{
$this->login();
}
else
{
echo 'Success'; die();
}
}
public function pword_check($str)
{
if ($str == 'test')
{
$this->form_validation->set_message('pword_check', 'The %s field can not be the word "test"');
return FALSE;
}
else
{
return TRUE;
}
}
Run Code Online (Sandbox Code Playgroud)