您好我是Code Ignitor的新手我想知道为什么我的代码产生了这个错误。
function index(){
$this->load->library('form-validation');
$this->form-validation-set_rules('username','Username','trim|required');
$this->form-validation-set_rules('password','Password','trim|required');
if ($this->form-validation->run() == FALSE) {
$this->load->view('reg_form_view');//failed input
} else {
//redirect('reg_success','refresh');
echo "success";
}
}
答案 0 :(得分:1)
我认为您使用了错误的opps对象调用语法。
function index(){
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','trim|required');
$this->form_validation->set_rules('password','Password','trim|required');
if($this->form_validation->run() == FALSE){
$this->load->view('reg_form_view');//failed input
}else{
//redirect('reg_success','refresh');
echo "success";
}
答案 1 :(得分:0)
尝试使用以下代码吗?
function index(){
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','trim|required');
$this->form_validation->set_rules('password','Password','trim|required');
if ($this->form_validation->run() == FALSE) {
$this->load->view('reg_form_view');//failed input
} else {
//redirect('reg_success','refresh');
echo "success";
}
}`
答案 2 :(得分:-1)
function index(){
$this->load->library('form_validation');
$this->form_validation->set_rules('username','Username','trim|required');
$this->form_validation->set_rules('password','Password','trim|required');
if($this->form_validation->run() == FALSE){
$this->load->view('reg_form_view');//failed input
}else{
//redirect('reg_success','refresh');
echo "success";
}
}