|
本帖最后由 ZhouYY 于 2020-5-20 09:40 编辑
PHP复制代码 $this->form_validation->set_rules("add_ctitle", "所属机房", "trim|required|callback_ctitle_check");
$this->form_validation->set_rules("add_name", "名称", "trim|required|callback_name_check");
$this->form_validation->set_rules("add_tezhu", "特注", "trim|in_list[VIP限定,外约车资依地方计,VIP限定(车资依地方计)]");
$this->form_validation->set_rules("add_cata2", "籍别", "trim|required|callback_cata2_check");
$this->form_validation->set_rules("add_cata1a", "县市", "trim|required|callback_cata_all_check");
$this->form_validation->set_rules("add_didian", "地点", "trim|required|callback_cata4_check");
复制代码
上面是我的验证规则
PHP复制代码
public function ctitle_check ($id)
{
$count = $this->Pub_mod->count("member", array("menu_id" => 23, "mem_account" => $id));
if (empty($count)) {
$this->form_validation->set_message("ctitle_check", "输入机房不存在");
return FALSE;
} else {
return TRUE;
}
}
复制代码
上面是我的callback
如果我规则里面有"required"不管有填写没有填写,一样都只会显示callback的错误讯息。
感觉callback是最大的,前面的规则都排在他后面。
这个有解吗?
|
|