如何从同一页面访问多个单独的reCAPTCHA响应?

时间:2015-03-28 09:01:55

标签: php json post recaptcha

我在同一页面上有多个reCAPTCHAS,默认情况下所有reCAPTCHAS都返回$_POST['g-recaptcha-response']。有没有办法让我可以为每个Recaptcha更改$ _POST名称,从而访问它们的各个响应?

如果我的网站密钥/密钥是相同的,这是否意味着我无法访问个别回复?

感谢您的帮助! :)

HTML:

<div class="g-recaptcha" id="recaptcha1"></div>
<div class="g-recaptcha" id="recaptcha2"></div>

jQuery的:

var recaptcha1 = $("#recaptcha1");
var recaptcha2 = $("#recaptcha2");
var myCallBack = function() {
    //Render the recaptcha1 on the element with ID "recaptcha1"
    recaptcha1 = grecaptcha.render('recaptcha1', {
    'sitekey' : 'removed_for_demonstration',
      'theme' : 'light'
    });

    //Render the recaptcha2 on the element with ID "recaptcha2"
    recaptcha2 = grecaptcha.render('recaptcha2', {
      'sitekey' : 'removed_for_demonstration',
      'theme' : 'light'
    });
};

PHP:

$captcha = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : "";

0 个答案:

没有答案