Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 谁能帮我解决这个问题;在不存在的类中遇到错误:recaptchalib";_Php_Codeigniter_Recaptcha_Captcha - Fatal编程技术网

Php 谁能帮我解决这个问题;在不存在的类中遇到错误:recaptchalib";

Php 谁能帮我解决这个问题;在不存在的类中遇到错误:recaptchalib";,php,codeigniter,recaptcha,captcha,Php,Codeigniter,Recaptcha,Captcha,我正在将recaptcha库更新为recaptchalib 我得到了这个错误 在不存在的类中遇到错误:recaptchalib 在库文件夹中包括库recaptchalib.php 用户控制器: $this->load->library('recaptchalib'); $data['fincaptcha_ok']=$this->recaptchalib->recaptcha_get_html(); $this->recaptchalib->recaptcha_check_answer($_SER

我正在将recaptcha库更新为recaptchalib

我得到了这个错误

在不存在的类中遇到错误:recaptchalib

  • 在库文件夹中包括库recaptchalib.php
  • 用户控制器:
  • $this->load->library('recaptchalib');
    $data['fincaptcha_ok']=$this->recaptchalib->recaptcha_get_html();
    $this->recaptchalib->recaptcha_check_answer($_SERVER['REMOTE_ADDR'],$this->input->post('recaptcha_challenge_field'),$this->input->post('recaptcha_response_field');
    如果(!$this->recaptchalib->getIsValid()){
    $this->load->helper('directory');
    $data['error']=“验证码不正确”;
    $data['body_content']='user/register';
    $this->load->view('template',$data);
    
  • 查看:

  • 如果我错了,请纠正我,但我认为您使用的是recaptcha lib

    此库提供了一组函数,没有对象实现。也就是说,如果您像这样使用它,它应该可以工作:

    $this->load->library('recaptchalib');
    
    $data['fincaptcha_ok'] = recaptcha_get_html();
    
    $objResponse = recaptcha_check_answer($_SERVER['REMOTE_ADDR'],$this->input->post('recaptcha_challenge_field'),$this->input->post('recaptcha_response_field'));
    
    if(!$objResponse->is_valid) 
    {
        $this->load->helper('directory');
        $data['error'] = 'incorrect captcha';
        $data['body_content']           = 'user/register';
        $this->load->view('template', $data);
    }
    
    作为补充信息,最终最好使用内置的验证码助手。仔细查看他们的文档


    我们可以看看“$this->load->library”做什么吗?