Google ReCaptcha 未发布“g-recaptcha-response" [英] Google ReCaptcha not posting 'g-recaptcha-response'

查看:130
本文介绍了Google ReCaptcha 未发布“g-recaptcha-response"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之前有人问过这个问题:新的 Google ReCaptcha 不发布/接收g-recaptcha-response" - 但没有正确答案.

This question has been asked before: New Google ReCaptcha not posting/receiving 'g-recaptcha-response' - but there was no proper answer.

我和他的设置完全一样,但是代码在这里失败了:

I have the exact same set up as him, but the code fails here:

if(!$captcha){
   exit;
}

所以 $captcha=$_POST['g-recaptcha-response'] 似乎是空的.

带有复选框服务器端 php 的新 google recaptcha =这里的第二个答案似乎也不起作用.

new google recaptcha with checkbox server side php = The 2nd answer here also doesn't seem to work.

有人知道为什么会发生这种情况吗?

Does anyone know why this could happen?

推荐答案

我遇到了这个问题,发现我的表单在 DOM 中过早关闭,因为它在一个表中.ReCaptcha 设置一个 display:none g-recaptcha-response textarea,然后在您完成验证码时填写数据.它似乎在寻找 div 所在形式的子级,因此找不到它最初创建的 g-recaptcha-response.我把表格放在桌子周围,之后就很好用了.

I encountered this issue and found that my form was closing prematurely in the DOM because it was inside a table. ReCaptcha sets up a display:none g-recaptcha-response textarea and later fills in the data when you complete the captcha. It seems to look for children of the form that the div is in and thus couldn't find the g-recaptcha-response it had initially created. I put the form around the table and it worked fine after that.

这篇关于Google ReCaptcha 未发布“g-recaptcha-response"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆