Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
匹配函数参数codeigniter_Codeigniter - Fatal编程技术网

匹配函数参数codeigniter

匹配函数参数codeigniter,codeigniter,Codeigniter,在表单验证中,当前密码必须与我登录的密码匹配。如果我引入的当前密码与我登录时使用的密码匹配,我可以更改密码。但它不起作用,我可以在我当前的密码字段中输入任何密码。我的问题是如何输入我用来登录的密码。(我用来记录的密码存储在会话中) 您需要对控制器内的函数进行回调 // call function to check $this->form_validation->set_rules('current_password','Current Password','trim|required

在表单验证中,当前密码必须与我登录的密码匹配。如果我引入的当前密码与我登录时使用的密码匹配,我可以更改密码。但它不起作用,我可以在我当前的密码字段中输入任何密码。我的问题是如何输入我用来登录的密码。(我用来记录的密码存储在会话中)


您需要对控制器内的函数进行回调

// call function to check
$this->form_validation->set_rules('current_password','Current Password','trim|required|callback_password_check');

// do your check and return false or true
public function password_check($str){

}
转到:

// call function to check
$this->form_validation->set_rules('current_password','Current Password','trim|required|callback_password_check');

// do your check and return false or true
public function password_check($str){

}