我如何重写这个仅限PHP成员的页面脚本?
我有这个代码,它向登录的用户显示特定的内容。然而,使用这个我不能在页面上包含其他php文件。是否需要重写它,以便我可以使用include函数我如何重写这个仅限PHP成员的页面脚本?,php,include,Php,Include,我有这个代码,它向登录的用户显示特定的内容。然而,使用这个我不能在页面上包含其他php文件。是否需要重写它,以便我可以使用include函数 <?php if($_SESSION['id']) echo '<div id="center" class="column">center here</div> <div id="left" class="column">leftbar here</div>
<?php
if($_SESSION['id'])
echo '<div id="center" class="column">center here</div>
<div id="left" class="column">leftbar here</div>
<div id="right" class="column">rightbar here</div>';
else
echo '<h1>Staff please, <a href="index.php">login</a>
before accessing this page, no access to students.</h1>';
?>
现在我不能把它写在“这里居中”、“这里左栏”和“这里右栏”的地方,这是:
`<?php include("center.php"); ?>`
``
我对所有这些东西都不熟悉,所以不要太复杂,谢谢 如果我理解正确,应该是这样的:
<?php
if($_SESSION['id'])
echo '<div id="center" class="column">';
include("center.php");
echo'</div>
<div id="left" class="column">';
include("leftbar.php");
echo'</div>
<div id="right" class="column">';
include("rightbar.php");
echo '</div>';
else
echo '<h1>Staff please, <a href="index.php">login</a>
before accessing this page, no access to students.</h1>';
?>
为什么不能使用include
?@AarolamaBluenk我在使用它们时似乎出现了语法错误。在代码的“else”部分获得语法,但其余部分看起来不错。你建议我怎么做?@TomCarter有一个语法错误;请重试该代码。该代码仍然存在语法错误:/n确实存在语法错误,但您还必须检查您的incude文件是否存在语法错误。什么线路?什么文件?