0
if (isset($_POST['btnSubmit']))
{
if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
echo $captcha;
if(!$captcha){
echo '<h2>Please check the the captcha form.</h2>';
exit;
}
$secretKey = "================";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
if(intval($responseKeys["success"]) !== 1) {
echo '<h2>You are spammer ! Get the @$%K out</h2>';
} else {
echo '<h2>Thanks for posting comment.</h2>';
}
这是我的代码,当点击提交表单,然后不确定的变量$ chaptcha请帮我
你有没有证实,'$ _ POST [ 'G-的reCAPTCHA响应']'的定义? – IzzEps
发表您的表单代码太 – Panda
[PHP的:“注意:未定义的变量”和“注意:未定义的索引”]的可能重复(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-注意,未定义指数) – Jocelyn