意外的$结束。

时间:2016-03-21 14:23:21

标签: php unexpectendoffile

我正在使用PHP和MySQL(PHPMyAdmin)创建一个注册表单,当我在浏览器(Mozilla Firefox)上打开页面时,我得到了

  

解析错误:语法错误,第71行意外的$ end

<?php

require('config.php');

if(isset($_POST['submit'])){

    //Verificació
    $email1 = $_POST['email1'];
    $email2 = $_POST['email2'];
    $pass1 = $_POST['pass1'];
    $pass2 = $_POST['pass2'];

    if($email1 == $email2){
        if ($pass1 == $pass2){
            //Tot bé!

            $name = mysql_escape_string($_POST['name']);
            $lname = mysql_escape_string($_POST['lname']);
            $email1 = mysql_escape_string($email1);
            $email2 = mysql_escape_string($email2);
            $pass1 = mysql_escape_string($pass1);
            $pass2 = mysql_escape_string($pass2);



        }else{
            die("Sorry, your passwords didn't match");
        }
    }else{
        die("Sorry, your emails didn't match");
    }


}else{

    echo <<<EOD

    <form action='register.php' method='POST'>
    First name:<input type='text' name='name' /><br/>
    Last name:<input type='text' name='lName' /><br/>
    Username:<input type='text' name='username' /><br/>
    Email:<input type='text' name='email' /><br/>
    Password:<input type='password' name='pass1' /><br/>
    Confirm password:<input type='password' name='pass2' /><br/>
    <input type='submit' value='Register' name='submit' />
    </form>
    EOD;

}

?>

我做得不好?有人能帮帮我吗?

1 个答案:

答案 0 :(得分:5)

关闭EOD;需要在行的开头(不用空格或制表符缩进)。请在此处查看大红色警告:http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc