我已经在这里和其他地方提供了很多链接和解决方案,但我无法解决我所面临的回调问题.我正在使用Codeigniter和HMVC,代码如下.
以下代码来自My_Form_validation.php:
class MY_Form_validation extends CI_Form_validation {
function run($module = '', $group = ''){
(is_object($module)) AND $this->CI = &$module;
return parent::run($group);
}
}
Run Code Online (Sandbox Code Playgroud)
下面如果回调函数:
public function _unique_email($str) {
// Check if user already exists
// Process only for current user
$id = $this->uri->segment(4);
$this->db->where('email', $this->input->post('email'));
!$id || $this->db->where('id !=', $id);
$user = $this->mdl_admin_users->get();
if (count($user)) {
$this->form_validation->set_message('_unique_email', 'User already exists. Please check %s.');
return FALSE;
}
return TRUE;
}
Run Code Online (Sandbox Code Playgroud)
和功能:
public function user_edit($id = NULL) {
// Fetch …Run Code Online (Sandbox Code Playgroud)