另一个PHP语法错误

kwe*_*wek -3 php syntax-error

这是错误:

解析错误:语法错误,第9行/home/idghosti/public_html/testground/mma/include/footer.php中的意外'}'

这是代码:

<?php
    } else {
        error_reporting(0);

        if  (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))

        //Message sent!
        //It the message that will be displayed when the user click the sumbit button
        //You can modify the text if you want
        echo nl2br("
        <div class=\"MsgSent\">
            <h1>Congratulations!!</h1>
            <p>Thank you <b>$name</b>, your message is sent!<br /> We will get back to you as soon as possible.</p>
        </div>
       ");

        else

        // Display error message if the message failed to send
        echo "
        <div class=\"MsgError\">
            <h1>Error!!</h1>
            <p>Sorry <b><?=$name;?></b>, your message failed to send. Try later!</p>
        </div>";
    }
?>
Run Code Online (Sandbox Code Playgroud)

Tom*_*igh 7

PHP块不能跨越文件.看起来这就是你想要做的事情.

此外,如果你突破块直接输出HTML,我发现使用替代语法更具可读性.