我在下面有下面的代码。我的问题是它只触发回调。 required和valid_email规则不会被调用。我期望按顺序执行规则。但是当我删除回调它运行正常。 TIA。Codeigniter表单验证回调问题
$this->form_validation->set_rules('search_word', 'Email address', 'trim|required|valid_email|callback_has_valid_credentials');
$this->form_validation->set_message('has_valid_credentials', '{field} is not registered in the system.');
if ($this->form_validation->run() == FALSE){
$this->load->view('login/reset');
return;
}
您是否定义了一个名为has_valid_credentials的函数? –
请尝试[this](http://stackoverflow.com/a/40836772/6054930);) – ShutUpMagda
@ErolKESKİN是的,我有函数名为has_valid_credentials。我尝试了前缀'callback_has_valid_credentials',并通过数据库进行搜索。我也尝试没有** callback_前缀**和必需和valid_email都工作,但回调不是。这是一个错误吗? – Tooteet