gpt4 book ai didi

php - 第 35 行出现意外的文件结束错误

转载 作者:行者123 更新时间:2023-11-29 07:23:37 25 4
gpt4 key购买 nike

错误是

Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\project\inc\header.inc.php on line 35

下面的代码是针对错误所在的头文件:

<?php 
include ("./inc/connect.inc.php");
session_start();
if (!isset($_SESSION["user_login"])){
}
else
{
header("location: home.php")
?>


<html>
<head>
<title>Memory Lane</title>
<link rel="stylesheet" type="text/css" href="./css/style.css"
</head>
<body>
<div class="HeaderMenu">
<div id="wrapper">
<div class="logo">
<img src="./Image/Memorylane_logo.jpg"/>
</div>
<div class="search_box">
<form action="search.php" method="GET" ID="search">
<input type="text" name="q" size="60" placeholder="Search ..."/>
</form>
</div>
<div id="menu">
<a href ="#"/>Home</a>
<a href ="#"/>About</a>
<a href ="#"/>Sign Up</a>
<a href ="#"/>Sign In</a>
</div>
</div>
</div>

最佳答案

你在这里弄乱了结束}:

<?php 
include ("./inc/connect.inc.php");
session_start();
if (!isset($_SESSION["user_login"])){
}
else
{
header("location: home.php"); // <-- You were also missing a semicolon here
exit; // <-- and an exit is a good thing to use after an header
} // <--- You should add this one
?>

此外,如果您缩进代码,将更容易捕获丢失的括号,如下所示:

<?php 
include ("./inc/connect.inc.php");
session_start();
if (!isset($_SESSION["user_login"])){
//Also putting some code here would be a good idea
} else {
header("location: home.php");
exit;
}
?>

关于php - 第 35 行出现意外的文件结束错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35256899/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com