如何在我的php文件中修复此解析错误?

时间:2016-07-03 07:47:00

标签: php parse-error

我在下面的代码中收到了以下错误:(解析错误:语法错误,意外的文件结束,期待'`' in)。

<?php
    include_once 'connect.php';
    include_once 'functions.php';

    sec_session_start(); // Our custom secure way of starting a PHP session.

    if (isset($_POST['email'], $_POST['p'])) {
        $email = $_POST['email'];
        $password = $_POST['p']; // The hashed password.
        if (login($email, $password, $mysqli) == true) {
            // Login success 
            header('Location: ../protected_page.php');
    `   //echo 'Login Successful';
        } 
        else {
            // Login failed 
            header('Location: ../loginpage.php?error=1');
        //echo "Login Unsuccessful";
        }
    } 
    else {
        // The correct POST variables were not sent to this page. 
        echo "Invalid Request";
    } ?>

2 个答案:

答案 0 :(得分:0)

你错过了

的大括号
if (login($email, $password, $mysqli) == true) {
如果条件

也缺少父级的大括号

if (isset($_POST['email'], $_POST['p'])) {

答案 1 :(得分:0)

也许&#39; connect.php&#39;或者&#39; functions.php&#39;文件将包括&#39;`&#39;字符。 请调查这些文件。