Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将reCaptchaV3集成到联系人表单中?_Php_Html_Validation_Contacts_Recaptcha V3 - Fatal编程技术网

Php 如何将reCaptchaV3集成到联系人表单中?

Php 如何将reCaptchaV3集成到联系人表单中?,php,html,validation,contacts,recaptcha-v3,Php,Html,Validation,Contacts,Recaptcha V3,首先,我是一个狂热的爱好者,但在任何方面都不是专业人士,所以我掌握了一些编码的基本知识。 我正在尝试将reCaptcha V3集成到我现有的联系人表单中。 但我不知道是否做对了。我一直像疯子一样在谷歌上搜索,但所有的“怎么做”都在做一些不同的事情。我昨天用这个例子添加了它:在分析中得到了一些0.9分的结果,但我仍然不确定它是否正确工作 我用这个测试了我的分数,结果是0.9分 我在自己的网站上尝试将所需分数改为1.0,但提交仍然成功 这是我为加载reCaptcha而添加的内容: <!DOCT

首先,我是一个狂热的爱好者,但在任何方面都不是专业人士,所以我掌握了一些编码的基本知识。 我正在尝试将reCaptcha V3集成到我现有的联系人表单中。 但我不知道是否做对了。我一直像疯子一样在谷歌上搜索,但所有的“怎么做”都在做一些不同的事情。我昨天用这个例子添加了它:在分析中得到了一些0.9分的结果,但我仍然不确定它是否正确工作

我用这个测试了我的分数,结果是0.9分 我在自己的网站上尝试将所需分数改为1.0,但提交仍然成功

这是我为加载reCaptcha而添加的内容:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" href="styles/contact.css">
<link rel="stylesheet" href="styles/layout.css">
<link rel="stylesheet" href="validate/css/style.css">
                                                                <!----- SITE KEY REPCAPTCHA ----->
<script src="https://www.google.com/recaptcha/api.js?render=*****"></script>
<script>
    grecaptcha.ready(function() {
    grecaptcha.execute('******', {action: 'contact'}).then(function(token) {
       $('#contact').prepend('<input type="hidden" name="token" value="' + token + '">');
       $('#contact').prepend('<input type="hidden" name="action" value="contact">');
       $('#contact').unbind('submit').submit();
    });
});
</script>
但这会导致提交失败

我希望有人能了解我的情况。这样行吗?行吗?还是我犯了什么错误


提前谢谢

我遵循了本教程,效果很好。

试着看看你的代码是否有问题

您应该在HTML中包含jQuery以使$working

The $('#contact') part give's an error in firefox console: ReferenceError: $ is not defined. But i found other pieces of code were this is also used so i guess it just works?

我遵循了本教程,效果很好。

试着看看你的代码是否有问题

您应该在HTML中包含jQuery以使$working

The $('#contact') part give's an error in firefox console: ReferenceError: $ is not defined. But i found other pieces of code were this is also used so i guess it just works?
        if($arrResponse["success"] == '1' && $arrResponse["action"] == $action && $arrResponse["score"] >= 0.5) {
            // valid submission
            // go ahead and do necessary stuff
        } else {
    --------->      $formok = false;
                        $errors[] = "reCaptcha you are a bot";
            // spam submission
            // show error message
        }
The $('#contact') part give's an error in firefox console: ReferenceError: $ is not defined. But i found other pieces of code were this is also used so i guess it just works?