请检查下面的代码,并在使用require时告诉它有什么问题。PHP需求不能按我期望的那样工作
首先这里是工作(不使用它需要)的代码:
<?php
//require("_start.inc");
session_start();
if(!isset($_SESSION['user']))
{
echo "<h1 style='color:red'>Please <a href='../index.php'>login</a> first!</h1>";
}
else
{
?>
<!DOCTYPE html>
<html>
<head>
<title>Main window</title>
</head>
<body>
<h1>Admin panel</h1>
<?php
require("header.inc");
?>
</body>
</html>
<?php
//require("_end.inc");
}
?>
这里是行不通的版本,_start.inc和_end.inc是什么是写在上面的代码,但下面的人给我的错误: 解析错误:语法错误,在C意外的文件结尾:\ XAMPP \ htdocs中\第9行
<?php
require("_start.inc");
/*session_start();
if(!isset($_SESSION['user']))
{
echo "<h1 style='color:red'>Please <a href='../index.php'>login</a> first!</h1>";
}
else
{
*/
?>
<!DOCTYPE html>
<html>
<head>
<title>Main window</title>
</head>
<body>
<h1>Admin panel</h1>
<?php
require("header.inc");
?>
</body>
</html>
<?php
require("_end.inc");
//}
?>
这个文件叫什么 - 是你提出的“admin_start.inc”? – halfer 2013-02-14 23:53:56