我认为解决方案很容易(如果我的问题正确)
制定两组规则
$this->form_validation->set_rules('name','Duplicate Name','trim|required|is_unique[mcb.name]');
$this->form_validation->set_rules('name','Duplicate Name','trim|required');
if()
使用前做一个validation->run()
像这样
if ( strtoupper($this->input->post('name')) == strtoupper($old_name) ) { //pass old name in hidden field or load it before this condition via model
$this->form_validation->set_rules('name','Duplicate Name','trim|strtoupper|required');
} else {
$this->form_validation->set_rules('name','Duplicate','trim|required|strtoupper|is_unique[mcb.name]');
}
//all other form_validation checks here
if ($this->form_validation->run()) {}
//添加了编辑strtoupper()
,因此您的唯一值确实是唯一的