我遇到此代码的问题:
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|callback_user_check');
即使用户名字段为空,它也会显示user_check
错误;我期待所需的错误消息。
function username() {
$query = "SELECT salt FROM user WHERE username = ?";
$get_query = $this->db->query($query, array($this->username));
if ($get_query->num_rows() > 0) {
$row = $get_query->row_array();
return $row['salt'];
} else {
return false;
}
}
答案 0 :(得分:0)
设置验证自定义消息
$this->form_validation->set_message('username', 'Your message here');