纳尼啦 发表于 2016-12-5 20:33:34

CI form_valid 只支持post吗,我用了put,感觉校验不起效

         $this->form_validation->set_rules('old_password', 'Old password', 'required');
//         $this->form_validation->set_rules('new_password', 'New Password', 'required|min_length['.$this->config->item('min_password_length', 'ion_auth').']|max_length['.$this->config->item('max_password_length', 'ion_auth').']|matches');
//         $this->form_validation->set_rules('new_password_confirm', 'Confirm New Password', 'required');

      $put = $this->input->input_stream();
      $id = $put['id'];

      //校验
      if( $put['new_password'] != $put['new_password_confirm'] ){
            echo json_encode(array('status'=>'error','message'=>'两次输入的密码不匹配'));
            exit;
      }

      $user = $this->ion_auth->get_user($id);

      if ($this->form_validation->run())
      {



Hex 发表于 2016-12-6 14:06:31

你说对了,只支持 POST,不过你可以把 PUT 参数放到 $_POST 这个变量里。

纳尼啦 发表于 2016-12-9 16:50:35

Hex 发表于 2016-12-6 14:06
你说对了,只支持 POST,不过你可以把 PUT 参数放到 $_POST 这个变量里。

好的,我覆盖下库试试
页: [1]
查看完整版本: CI form_valid 只支持post吗,我用了put,感觉校验不起效