1
我已經使用回調函數來檢查電子郵件是否激活: 我的控制器沒有訪問回調函數。回調函數在codeigniter中不起作用
我控制器代碼:
function index() {
//Session redirection
header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0',false);
header('Pragma: no-cache');
$this->session->unset_userdata('created_user_id');
$this->session->unset_userdata('created_user_type');
$this->session->unset_userdata('edit_user_type');
if ($this->input->server('REQUEST_METHOD') === 'POST'){
$this->form_validation->set_rules('email', 'Email ID', 'trim|required|valid_email');
$this->form_validation->set_rules('terms', 'Terms', 'trim|required');
if($this->input->post('email'))
{
$this->form_validation->set_rules('email', 'Email ID', 'callback_email_check');
} echo "out"; die;
$this->form_validation->set_error_delimiters('<div class="error_user" style="color:red">', '</div>');
if($this->form_validation->run()){
if($this->input->post('Join')!="") {
$this->session->set_userdata('join_email', $this->input->post('email'));
redirect(base_url().'caregivers/my-account');
}
}
}
$this->load->view('site/landing-page');
}
我的回調函數代碼:
public function email_check(){
$get_status = $this->web_user_model->get_status($this->input->post('email'));
if($get_status['is_active']=='1')
{
$this->form_validation->set_message('email_check','Email ID already Exits');
return FALSE;
}else{
return TRUE;
}
}
我不知道我做了錯誤。 任何人都可以幫我嗎? 在此先感謝..