Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.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在google recaptcha上获得意外的文件结尾_Php_Recaptcha - Fatal编程技术网

PHP在google recaptcha上获得意外的文件结尾

PHP在google recaptcha上获得意外的文件结尾,php,recaptcha,Php,Recaptcha,我需要一些帮助,我正在将google recaptcha实现到一个php站点中,但在完成代码并上传后,此错误显示为: 分析错误:语法错误,中的文件意外结束 /home/cbj/public_html/2016/requestudform.php,第29行 现在,这是我的recaptcha代码 <?php $memberType;$name;$email;$phone;$address;$captcha; if(isset($_POST['memberType'])){

我需要一些帮助,我正在将google recaptcha实现到一个php站点中,但在完成代码并上传后,此错误显示为:

分析错误:语法错误,中的文件意外结束 /home/cbj/public_html/2016/requestudform.php,第29行

现在,这是我的recaptcha代码

<?php
    $memberType;$name;$email;$phone;$address;$captcha;
    if(isset($_POST['memberType'])){
      $memberType=$_POST['memberType'];
    }
    if(isset($_POST['name'])){
      $name=$_POST['name'];
    }
    if(isset($_POST['email'])){
      $email=$_POST['email'];
    }
    if(isset($_POST['phone'])){
      $phone=$_POST['phone'];
    }
    if(isset($_POST['address'])){
      $address=$_POST['address'];
    }
    if(isset($_POST['g-recaptcha-response'])){
      $captcha=$_POST['g-recaptcha-response'];
    }
    if(!$captcha){
      echo '<div class="alert alert-warning">
              Por favor, verifica que seas humano
            </div>';
      exit;
    }
    $secretKey = "6LeEECoTAAAAAGLUBgHQ_OC-ZYJi0Sj2b_1JPRUx";
    $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha);
    $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>';
    } 
?>


感谢您的帮助。

由于某些原因,本地PC上没有检测到(甚至没有保存)最后一个分号,直接在服务器上编写代码是可行的。

缩进和断行完全是冒犯。难怪您有语法错误。如果堆栈溢出复制/粘贴给您带来问题,很抱歉,只是错误出现在最后一行,所以…您有答案吗?这与堆栈溢出复制粘贴无关,而是与您的代码有关。顺便说一句,这也是你现在面临的错误的来源。所以,现在修复了,仍然有错误…如果这不是问题(因为你在这里),你能帮我修复吗?谢谢你宝贵的帮助“PeeHaa”,你让这个世界变得更好。