谁能帮我解决这个问题"An Error Was Encountered Non-existent class: recaptchalib"
can anyone help me to resolve the issue "An Error Was Encountered Non-existent class: recaptchalib"
我正在将 recaptcha 库更新为 recaptchalib。
我遇到了这个错误。
An Error Was Encountered Non-existent class: 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'));
if(!$this->recaptchalib->getIsValid()) {
$this->load->helper('directory');
$data['error'] = 'incorrect captcha';
$data['body_content'] = 'user/register';
$this->load->view('template', $data);
- 查看:
<?php echo $fincaptcha_ok; ?>
如果我错了请纠正我,但我认为你使用 this recaptcha 库。
这个库提供了一组函数,没有对象实现。那就是说,如果您像这样使用它应该可以工作:
$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);
}
As an additional information, eventually it's better to use the built in captcha helper. Take a closer look at their documenation here.
我正在将 recaptcha 库更新为 recaptchalib。
我遇到了这个错误。
An Error Was Encountered Non-existent class: 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'));
if(!$this->recaptchalib->getIsValid()) {
$this->load->helper('directory');
$data['error'] = 'incorrect captcha';
$data['body_content'] = 'user/register';
$this->load->view('template', $data);
- 查看:
<?php echo $fincaptcha_ok; ?>
如果我错了请纠正我,但我认为你使用 this recaptcha 库。
这个库提供了一组函数,没有对象实现。那就是说,如果您像这样使用它应该可以工作:
$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);
}
As an additional information, eventually it's better to use the built in captcha helper. Take a closer look at their documenation here.