Php Google reCaptcha联系人表单集成
您好,我在我的网站上有一个联系表单,我想包括谷歌reCaptcha,我已经按照指南尝试并整合了它,但当我尝试在live表单上进行测试运行时,我收到了这个错误消息 致命错误:在中调用未定义的函数getResponse() /home/guildina/public_html/contact-form.php,第20行 我的联系人表单当前如下所示:Php Google reCaptcha联系人表单集成,php,recaptcha,Php,Recaptcha,您好,我在我的网站上有一个联系表单,我想包括谷歌reCaptcha,我已经按照指南尝试并整合了它,但当我尝试在live表单上进行测试运行时,我收到了这个错误消息 致命错误:在中调用未定义的函数getResponse() /home/guildina/public_html/contact-form.php,第20行 我的联系人表单当前如下所示: <?php $to="contact@guildinator.com"; $subject="Message from the website
<?php
$to="contact@guildinator.com";
$subject="Message from the website";
$date=date_default_timezone_set("l, F jS, Y");
$time=date_default_timezone_set("h:i A");
$type=$_REQUEST['type'];
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$subject=$_REQUEST['subject'];
$message=$_REQUEST['message'];
$msg = "";
$msg .= "Message sent from website on date: $date, hour: $time.\n";
$msg .= "Email: $email\n";
if(grecaptcha.getResponse() == "")
alert("You can't proceed!");
else
alert("Thank you");
if($name == "" && $type == 'contact') {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Name field.
</div>";
} else if($email=="") {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Email field.
</div>";
} else if($message == "" && $type == 'contact') {
echo "<div class='alert alert-danger'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Warning!</strong> Please fill the Message field.
</div>";
} else {
mail($to,$subject,$msg,"From:".$email);
echo "<div class='alert alert-success'>
<a class='close' data-dismiss='alert'>×</a>
<strong>Thank you!</strong>
</div>";
}
?>
您使用的是哪个版本的Google reCaptcha?我想是最近的一个,我几天前才注册的,是v2.0吗?您是如何呈现reCaptcha的?它显示正确吗?可能会引导您朝正确的方向前进。正如您所知,grecaptcha.getResponse()
不是捕获reCaptcha响应的正确方法,请使用$\u POST['g-reCaptcha-response']
。请先阅读。您使用的是哪个版本的Google reCaptcha?我想是最近的一个,我几天前才注册的,是v2.0吗?您是如何呈现reCaptcha的?它显示正确吗?可能会引导您朝正确的方向前进。正如您所知,grecaptcha.getResponse()
不是捕获reCaptcha响应的正确方法,请使用$\u POST['g-reCaptcha-response']
。请先读。