0
我的情況有點複雜。我想創建$配置規則,我form_validation使我的代碼更乾淨,但問題就在這裏:如何在CodeIgniter中添加config_d Form_validation?
if($this->input->post('usertype') == "new_user")
{
$this->form_validation->set_rules('new_email', 'E-mail Address', 'required|valid_email');
$this->form_validation->set_rules('new_firstname', 'First Name', 'required');
$this->form_validation->set_rules('new_lastname', 'Last Name', 'required');
$this->form_validation->set_rules('new_password', 'Password', 'required|matches[password_conf]');
$this->form_validation->set_rules('password_conf', 'Password Confirmation', 'required');
} else {
$this->form_validation->set_rules('login_email', 'Login E-mail Address', 'required|valid_email');
$this->form_validation->set_rules('login_password', 'Login Password Address', 'required');
}
我該怎麼辦,如果我有有條件的規則?