簡體   English   中英

當我運行此代碼時給出Parse錯誤:語法錯誤,意外的文件結束

[英]when i run this code gives Parse error: syntax error, unexpected end of file

<?php
    require('config.php');
    if(isset($_POST['submit'])){
    }else{
    $form =<<<EOT
    <form action="reg.php" method="POST">
        First Name: <input type="text" name="name"/><br />
        Last Name: <input type="text" name="lname"/><br />
        Username: <input type="text" name="uname"/><br />
        Email: <input type="text" name="email1"/><br />
        Confirm Email: <input type="text" name="email2"/><br />
        Password: <input type="password" name="pass1"/><br />
        Confirm Password: <input type="password" name="pass2"/><br />
        <input type="submit" value="Register" name="submit"/>
    </form>
    EOT;
    echo $form;
    }
?>

你的“EOT”不能縮進,它必須在行的開頭(遺憾地)。

在開始和結束EOT的定義時你不能有意圖......看下面的代碼。 這不好(它搞砸了其余代碼的意圖),但這是唯一的方法。

<?php
    require('config.php');

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

    }else{
$form =<<<EOT
    <form action="reg.php" method="POST">
    First Name: <input type="text" name="name"/><br />
    Last Name: <input type="text" name="lname"/><br />
    Username: <input type="text" name="uname"/><br />
    Email: <input type="text" name="email1"/><br />
    Confirm Email: <input type="text" name="email2"/><br />
    Password: <input type="password" name="pass1"/><br />
    Confirm Password: <input type="password" name="pass2"/><br />
    <input type="submit" value="Register" name="submit"/>
    </form>
EOT;
    }

    echo $form;

?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM