$user = $this->user_model->get_user_by_id('$id');
$this->form_validation->set_rules('username', '账户名称','required|trim|min_length[2]|max_length[32]|callback_username_edit_check['.$user['username'].']');
function username_edit_check($str,$username){
if ($str!=$username){
if (!$this->form_validation->is_unique($str,'user.username')){
$this->form_validation->set_message('username_edit_check', '账户名称被占用.');
return false;
}else{
return $str;
}
}else{
return $str;
}
}