【发布时间】:2020-12-22 22:10:40
【问题描述】:
我在我的网站上使用 google recaptcha v3,
这是我在我的 html 网页中添加的代码:
<script src="https://www.google.com/recaptcha/api.js?render=my public key"></script>
<script>
grecaptcha.ready(function () {
grecaptcha.execute('my public key', { action: 'contact' }).then(function (token) {
var recaptchaResponse = document.getElementById('recaptchaResponse');
ecaptchaResponse.value = token;
});
});
</script>
我在我的表单中添加了这个:
<input type="hidden" name="recaptcha_response" id="recaptchaResponse">
但是当我提交表单并尝试使用 var_dump() 查看 $_POST['recaptcha_response'] 的内容时 它只是一个空字符串:string(0) ""
错在哪里? 感谢您的回答!
【问题讨论】:
标签: recaptcha