Google ReCAPTCHA - 为验证用户的响应返回 JSON 语法错误 [英] Google ReCAPTCHA - JSON Syntax error returned for Verifying the user's response
问题描述
我在使用 Google ReCAPTCHA 时遇到问题.
I have a problem with the Google ReCAPTCHA.
在我的表单发布后(目前在同一页面上),当我检查 $_POST
变量时,我没有看到 $_POST['g-recaptcha-response']
在我的 POST 值中.
After my form is posted (for the moment on the same page), when I check the $_POST
var, I do not see a $_POST['g-recaptcha-response']
in my POST values.
但是当我在验证 recaptcha 期间检查我的网络活动时,我看到它正在向 google 发布 UserVerify,并且它在此处回复我:
But when I check my network activity during validating the recaptcha, I see it's Posting a UserVerify to google, and here it's responding me this :
以 )]}'
开头的 JSON 语法错误.
JSON Syntax error with )]}'
at the beginning.
我认为这就是我的 POST 中没有响应的原因,但我找不到原因.
I assume this is why I do not have the response in my POST, but I can't find why.
推荐答案
我找到了问题的解决方案.
I found the solution to my problem.
通过我的不同包含,我没有注意到我的验证码 HTML 代码在我的表单之外,这是有问题的.
With my differents includes, I didn't noticed that my Captcha HTML Code was outside my form, and this was problematic.
这篇关于Google ReCAPTCHA - 为验证用户的响应返回 JSON 语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!