function regist() {
$this->form_validation->set_rules('username', '用户名', 'callback_username_check');
$this->form_validation->set_rules('password', '密码', 'trim|required|min_length[6]|max_length[16]|matches[passconf]|md5');
$this->form_validation->set_rules('passconf', '确认密码', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$this->load->view('registration_view');
} else {
if ($this->User_model->regist()) {
echo '注册成功';
} else {
echo '注册失败';
}
}
}
function username_check($str) {
$this->form_validation->set_message('username_check', 'test');
return FALSE;
}