我遇到问题我已经尝试解决了3个星期,并且几乎无处可去。
我的网络应用程序工作得非常好,直到有一天它完全停止工作,因为我的header.php文件被搞砸了。
基本上,问题是:
我的header.php文件显示NOTHING(查看源不显示任何内容),页面完全是白色的。我已经打开了所有错误报告,并尝试在页面顶部回显事情,但在if语句中注释掉一些变量之前,NOTHING仍然有效(见下文)
以下是我的header.php文件的前几行代码。
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
echo("TEST");
session_start();
if(isset($_SESSION['username'])){ //VARIABLES WITHIN THIS STATEMENT CAUSE ERROR
$username = $_SESSION['username'];
$email = $_SESSION['email'];
$title = $_SESSION['title'];
$id = $_SESSION['id'];
$role = $_SESSION['role'];
$fullname = $_SESSION['fullname'];
$labname = $_SESSION['labname'];
$date_official = $_SESSION['date'];
$permission = $_SESSION['permission'];
$avatar = $_SESSION['avatar'];
$usr_ip = $_SERVER['REMOTE_ADDR'];
$isLogged = true;
}
else
{
$isLogged = false;
echo("Unlogged.");
}
if($isLogged)
{
if($permission == 7 || $permission == 1 || $permission == 2){
echo <<<_END
<!DOCTYPE html>
<html lang="en">
<head>
...file truncated for simplicity.
如果我注释掉$ permission和$ role,那么echo&#34; TEST&#34;运行,但页面的其余部分没有。我是一个PHP菜鸟,但说实话,我已经使用PHP近5年了,从来没有遇到过这样的事情。
我非常感谢任何帮助。非常感谢你。
干杯
编辑**我被要求粘贴我的整个代码:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
session_start();
echo("TEST");
if(isset($_SESSION['username'])){
$username = $_SESSION['username'];
$email = $_SESSION['email'];
$title = $_SESSION['title'];
$id = $_SESSION['id'];
$role = $_SESSION['role'];
$fullname = $_SESSION['fullname'];
$labname = $_SESSION['labname'];
$date_official = $_SESSION['date'];
$permission = $_SESSION['permission'];
$avatar = $_SESSION['avatar'];
$usr_ip = $_SERVER['REMOTE_ADDR'];
$isLogged = true;
}
else
{
$isLogged = true;
echo("Unlogged.");
}
if($isLogged)
{
if($permission == 7 || $permission == 1 || $permission == 2){
echo <<<_END
<!DOCTYPE html>
<html lang="en">
<head>
<!--CHARSET-->
<meta charset="UTF-8">
<!--FAVICON-->
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
<!--INTERNAL STYLING-->
<link href="css/style.css" rel="stylesheet">
<link href="css/core_styles.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/core_styles.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="css/calendar.css" />
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<link rel="stylesheet" href="css/dropzone.css">
<!--JQUERY AND JQUERY UI-->
<script src="js/jquery-2.2.3.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css" />
<!--INTERNAL SCRIPTS-->
<script src="js/functions.js"></script>
<script src="js/account.js"></script>
<script src="js/storage.js"></script>
<script src="js/notebook.js"></script>
<script src="js/protocol.js"></script>
<script src="js/calendar.js"></script>
<script src="js/members.js"></script>
<script src="js/administration.js"></script>
<script src="js/dash.js"></script>
<!--CHARTS-->
<script src="js/Chart.min.js"></script>
<!--DROPZONE-->
<script src="js/dropzone.js"></script>
<!--BOOTSTRAP-->
<link type="text/css" href="css/bootstrap.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
<!--SUMMERNOTE-->
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.1/summernote.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.1/summernote.css" rel="stylesheet">
<!--TOOLTIPS-->
<link rel="stylesheet" type="text/css" href="css/tooltipster.css" />
<script type="text/javascript" src="js/jquery.tooltipster.min.js"></script>
<title>FMAX ($labname)</title>
</head>
<body>
<div id="appWrapper">
<div id="point_prompt"></div>
<div id="appPanelLeft">
<!--LOGO CONTAINER-->
<div id="appLogo" class="subPanel">
<span class="logoF logoFont textDeny">F </span><span class="logoMax logoFont textDeny">M A X</span>
</div>
<!--PROFILE PICTURE CONTAINER-->
<div id="subPanel_0" class="subPanel">
<div class="profilePicture" style="background-image: url($avatar)"></div>
<div class="ta_center">
<span id="pnl_username" class="regTextPanelB">$fullname</span>
<br/>
<span id="pnl_permis" class="hintTextA">$role</span>
<br/>
<span id="pnl_degree" class="hintTextA">$title</span>
<br/>
</div>
</div>
<!--MAIN NAV CONTAINER-->
<div id="subPanel_1" class="subPanel">
<table id="navTable">
<tr>
<td>
<div data-value="0" class="pnlNavBtn">
<span class="fa fa-home fa-3x fa-fw myBlue"></span><br/>
<span class="regTextPanelA">Dashboard</span>
</div>
</td>
<td>
<div data-value="1" class="pnlNavBtn">
<span class="fa fa-book fa-3x fa-fw myPurple"></span>
<span class="regTextPanelA">Notebook</span>
</div></td>
</tr>
<tr>
<td>
<div data-value="2" class="pnlNavBtn">
<span class="fa fa-shopping-cart fa-3x fa-fw myYellow"></span>
<span class="regTextPanelA">Orders</span>
</div>
</td>
<td>
<div data-value="3" class="pnlNavBtn">
<span class="fa fa-list fa-3x fa-fw myOrange"></span>
<span class="regTextPanelA">Protocols</span>
</div>
</td>
</tr>
<tr>
<td>
<div data-value="4" class="pnlNavBtn">
<span class="fa fa-database fa-3x fa-fw myGreen"></span>
<span class="regTextPanelA">Storage</span>
</div>
</td>
<td>
<div data-value="5" class="pnlNavBtn">
<span class="fa fa-users fa-3x fa-fw myDarkBlue"></span>
<span class="regTextPanelA">Members</span>
</div>
</td>
</tr>
<tr>
<td>
<div data-value="6" class="pnlNavBtn">
<span class="fa fa-calendar fa-3x fa-fw myYellow"></span>
<span class="regTextPanelA">Calendar</span>
</div>
</td>
<td>
<div data-value="8" class="pnlNavBtn">
<span class="fa fa-lock fa-3x fa-fw myRose"></span>
<span class="regTextPanelA">Administration</span>
</div>
</td>
</tr>
</table>
</div>
<!--USER NAV CONTAINER-->
<div id="subPanel_2" class="subPanel">
<span class="hintTextA">User</span>
<br/>
<br/>
<div data-value="9" class="pnlNavBtn list">
<span class="fa fa-user fa-fw myBlue"></span>
<span class="regTextPanelA">Account</span>
</div>
<a href="logout.php"><div class="pnlNavBtn list">
<span class="fa fa-sign-out fa-fw myBlue"></span>
<span class="regTextPanelA">Logout</span>
</div>
</a>
</div>
<!--LAB MODULES CONTAINER-->
<div id="subPanel_3" class="subPanel">
<span class="hintTextA">Public Lab Page</span>
<br/>
<br/>
<div data-value="10" class="pnlNavBtn list">
<span class="fa fa-edit fa-fw myBlue"></span>
<span class="regTextPanelA">Edit Modules</span>
</div>
</div>
</div>
<div id="appWindow">
<!--TOOLBAR -->
<div id="appToolbar" class="row">
<nav class="navToolbar">
<ul>
<li id="app_msgs_btn"><span class="fa fa-lg fa-envelope-o myDarkBlue"></span> <span class="notificationHint small" id="inboxHint">0</span></li>
<li id="app_notif_btn"><span class="fa fa-lg fa-exclamation-circle myRose"></span> <span class="notificationHint small" id="notifHint">0</span></li>
<ul>
</nav>
</div>
<div id="notificationPane">
<div class="notification">
<span class="fa fa-fw fa-exclamation myRed"></span> Lorem ipsum dolor sit amet.
</div>
<div class="notification">
<span class="fa fa-fw fa-exclamation myRed"></span> If you type for long enough, your text might just extend two lines.
</div>
<div class="notification">
<span class="fa fa-fw fa-exclamation myRed"></span> Some Content.
</div>
<div class="notification">
<span class="fa fa-fw fa-exclamation myRed"></span> Some Content.
</div>
<div class="notification read">
<span class="fa fa-fw fa-exclamation myRed"></span> Some Content.
</div>
</div>
_END;
}
}
else{
echo("Error.");
}