在以下以下php代码中,当我包含“ teacher-header.php”时,会遇到错误
Parse error: syntax error, unexpected '}' in C:\xampp\htdocs\eClassroom\teacher-dashboard.php on line 100
“ teacher-dashboard.php”中的第100行是<?php }?>
。我该怎么办?
teacher-dashboard.php
<?php
session_start();
if((isset($_SESSION['email'])) && isset($_SESSION['password'])){
?>
<?php include 'components/teacher-header.php'?>
<section class="teacher-section-area">
<div class="container">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-heading overview-heading">
<h3 class="panel-title text-center">Dashboard</h3>
</div>
<div class="panel-body">
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-user-graduate"></i> 8</h2>
<h4>Students</h4>
</div>
</div>
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-video"></i> 12</h2>
<h4>Videos</h4>
</div>
</div>
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-file-signature"></i> 5</h2>
<h4>Lectures</h4>
</div>
</div>
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-chalkboard-teacher"></i> 3</h2>
<h4>ClassRooms</h4>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading overview-heading">
<h3 class="panel-title text-center">Running ClassRoom List</h3>
</div>
<div class="panel-body">
<div class="card">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">No.</th>
<th scope="col">Course Name</th>
<th scope="col">Course Code</th>
<th scope="col">Action </th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Algorithm</td>
<td>CSE 302</td>
<td>
<a class="btn btn-sm btn-primary" href="classrooms-files-videos.html">
<i class="#"></i>View
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--col-md-9 div END-->
</div>
<!--row div END-->
</div>
<!--container div END-->
</section>
<?php }?>
<script src="assets/js/vendor/jquery-1.11.3.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>
<?php
}
else{
header('Location: home.php');
}
?>
teacher-header.php
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>e-ClassRoom Management System</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/normalize.css">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/flaticon.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/responsive.css">
<script src="assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<header class="teacher_panel-area panel-header-area">
<div class="container">
<div class="row">
<div class="col-md-2">
<div class="logo">
<!--====== LOGO HERE ======-->
<a href="teacher-dashboard.php">
<p>eClassroom</p>
</a>
</div>
</div>
<div class="col-md-10">
<nav class="teacher_menu adtec-menu">
<ul>
<li class="#">
<a href="#">
<i class="fa fa-user-circle"></i> Welcome,
<Span class="teacher_name">Teacher Name</Span>
</a>
</li>
<li>
<a href="includes/logout.php">
<i class="fa fa-sign-out"></i> Logout
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<?php
if($_SESSION['approval'] == '0'){
echo '<div class="container">
<div class="row">
<div class="panel panel-primary text-center">
<div class="panel-heading"><strong>Approval Notice</strong></div>
<div class="panel-body">Your account is waiting for admin approval. Once approved, you can avail the dashboard options.</div>
</div>
</div>
</div>';
}
else{
?>
<!-- content area start -->
<div class="content-area">
<!-- sidebar area start -->
<div class="sidebar-area hidden-xs">
<div class="sidebar-menu">
<div class="dashboard-name">
<p> Teacher Panel</p>
</div>
<ul>
<li><a href="teacher-dashboard.html"><i class="fas fa-tachometer-alt"></i> Dashboard</a></li>
<li><a href="#"><i class="fas fa-user-graduate"></i> students </a>
<!-- sub menu start -->
<ul>
<li><a href="show-all-students.html"><i class="fas fa-eye"></i> show all students</a></li>
</ul>
<!-- sub menu end -->
</li>
<li><a href="#"><i class="fas fa-chalkboard-teacher"></i> ClassRooms </a>
<!-- sub menu start -->
<ul>
<li><a href="create-classrooms.html"><i class="fas fa-plus-circle"></i> Create ClassRoom</a></li>
</ul>
<!-- sub menu end -->
</li>
<li><a href="#"><i class="fas fa-file-alt"></i> Assignment </a>
<!-- sub menu start -->
<ul>
<li><a href="show-all-assignments.html"><i class="fas fa-copy"></i> Show All Assignment</a></li>
</ul>
<!-- sub menu end -->
</li>
<li><a href="edit-teacher-profile.html"><i class="fas fa-user-circle"></i> Profile</a></li>
</ul>
</div>
</div>
<!-- sidebar area end -->
</div>
<!-- content area end -->
答案 0 :(得分:1)
您没有正确关闭方括号,请使用以下命令并检查其是否适合您。
主文件:
<?php
session_start();
if((isset($_SESSION['email'])) && isset($_SESSION['password'])){
?>
<?php include 'components/teacher-header.php';?>
<section class="teacher-section-area">
<div class="container">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-heading overview-heading">
<h3 class="panel-title text-center">Dashboard</h3>
</div>
<div class="panel-body">
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-user-graduate"></i> 8</h2>
<h4>Students</h4>
</div>
</div>
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-video"></i> 12</h2>
<h4>Videos</h4>
</div>
</div>
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-file-signature"></i> 5</h2>
<h4>Lectures</h4>
</div>
</div>
<div class="col-md-3">
<div class="well dash-box">
<h2><i class="fas fa-chalkboard-teacher"></i> 3</h2>
<h4>ClassRooms</h4>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading overview-heading">
<h3 class="panel-title text-center">Running ClassRoom List</h3>
</div>
<div class="panel-body">
<div class="card">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">No.</th>
<th scope="col">Course Name</th>
<th scope="col">Course Code</th>
<th scope="col">Action </th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Algorithm</td>
<td>CSE 302</td>
<td>
<a class="btn btn-sm btn-primary" href="classrooms-files-videos.html">
<i class="#"></i>View
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--col-md-9 div END-->
</div>
<!--row div END-->
</div>
<!--container div END-->
</section>
<?php }
else
{
header('Location: home.php');
}
?>
<script src="assets/js/vendor/jquery-1.11.3.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>
teacher-header.php
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>e-ClassRoom Management System</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/normalize.css">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/flaticon.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/responsive.css">
<script src="assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<header class="teacher_panel-area panel-header-area">
<div class="container">
<div class="row">
<div class="col-md-2">
<div class="logo">
<!--====== LOGO HERE ======-->
<a href="teacher-dashboard.php">
<p>eClassroom</p>
</a>
</div>
</div>
<div class="col-md-10">
<nav class="teacher_menu adtec-menu">
<ul>
<li class="#">
<a href="#">
<i class="fa fa-user-circle"></i> Welcome,
<Span class="teacher_name">Teacher Name</Span>
</a>
</li>
<li>
<a href="includes/logout.php">
<i class="fa fa-sign-out"></i> Logout
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<?php
if($_SESSION['approval'] == '0'){
echo '<div class="container">
<div class="row">
<div class="panel panel-primary text-center">
<div class="panel-heading"><strong>Approval Notice</strong></div>
<div class="panel-body">Your account is waiting for admin approval. Once approved, you can avail the dashboard options.</div>
</div>
</div>
</div>';
}
else{
?>
<!-- content area start -->
<div class="content-area">
<!-- sidebar area start -->
<div class="sidebar-area hidden-xs">
<div class="sidebar-menu">
<div class="dashboard-name">
<p> Teacher Panel</p>
</div>
<ul>
<li><a href="teacher-dashboard.html"><i class="fas fa-tachometer-alt"></i> Dashboard</a></li>
<li><a href="#"><i class="fas fa-user-graduate"></i> students </a>
<!-- sub menu start -->
<ul>
<li><a href="show-all-students.html"><i class="fas fa-eye"></i> show all students</a></li>
</ul>
<!-- sub menu end -->
</li>
<li><a href="#"><i class="fas fa-chalkboard-teacher"></i> ClassRooms </a>
<!-- sub menu start -->
<ul>
<li><a href="create-classrooms.html"><i class="fas fa-plus-circle"></i> Create ClassRoom</a></li>
</ul>
<!-- sub menu end -->
</li>
<li><a href="#"><i class="fas fa-file-alt"></i> Assignment </a>
<!-- sub menu start -->
<ul>
<li><a href="show-all-assignments.html"><i class="fas fa-copy"></i> Show All Assignment</a></li>
</ul>
<!-- sub menu end -->
</li>
<li><a href="edit-teacher-profile.html"><i class="fas fa-user-circle"></i> Profile</a></li>
</ul>
</div>
</div>
<!-- sidebar area end -->
</div>
<!-- content area end -->
<?php } ?>