我是第一次在网站上使用谷歌验证码并通过此链接下载。
谷歌验证码在我的表单上工作正常,但每当用户按下按钮表单时,都会转到其他链接。 我需要让这个谷歌验证码成为必需的。 请解决这个问题,谢谢
<?php
require_once "recaptchalib.php";
$siteKey = "Site key";
$secret = "Secret key";
$lang = "en";
$resp = null;
$error = null;
$reCaptcha = new ReCaptcha($secret);
if(isset($_POST["g-recaptcha-response"])) {
$resp = $reCaptcha->verifyResponse(
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}
?>
<html>
<head><title>reCAPTCHA Example</title></head>
<body>
<?php
if ($resp != null && $resp->success) {
echo "You got it!";
}
?>
<form method="post">
<div class="g-recaptcha" data-sitekey="<?php echo $siteKey;?>"></div>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>"></script>
<br/>
<input type="submit" value="submit" />
</form>
</body>
</html>
对于显示错误消息,因为验证码不正确,请使用链接 http://mycodde.blogspot.com/2014/12/new-checkbox-recaptcha-tutorial-with.html
我认为您配置错误了重新验证码代码,请检查以下链接并重新设置代码
https://code.google.com/p/recaptcha/wiki/HowToSetUpRecaptcha#PHP