我已经尝试在我的Codeigniter应用程序中实现recaptcha,但它会引发错误。
我已经加载了我的助手:
$this->load->helper('recaptchalib_helper');
我的控制器:
$publickey = $this->config->item('recaptchakey');
$data['recaptchakey'] = $publickey;
$return = recaptcha_check_answer($publickey, $_SERVER["REMOTE_ADDR"], $this->input->post("recaptcha_challenge_field"), $this->input->post("recaptcha_response_field"));
if($this->form_validation->run() == FALSE){
$this->load->view('form', $data);
} else {
if(!$return->is_valid) {
echo 'failed';
$this->load->view('form', $data);
} else {
echo 'success';
$this->load->view('form', $data);
}
反复出现的错误是“invalid-site-private-key”和“incorrect-captcha-sol” - 有人可以告诉我哪里出错了吗?提前谢谢。
答案 0 :(得分:1)
invalid-site-private-key
与您在配置文件中输入的数据相关。在此处阅读更多内容:https://developers.google.com/recaptcha/docs/verify
incorrect-captcha-sol
与构建视图的方式有关。阅读更多:Need help with reCAPTCHA - keep getting incorrect-captcha-sol