我有lecturer
div。我隐藏了这个div。在那之后if($user->hasPermission('admin'))
这个函数是真的,我想显示lecturer
div。我会像这样放置****
个星。我想要那个地方的show div。
<?php
require_once 'core/init.php';
$user = new User();
if($user->isLoggedIn()) {
?>
<li><a href="logout.php">Log Out</a></li>
<div class="lecturer" id="lecturer" style="display: none;">
<label for="studentID">Student ID</label>
</div>
<?php
if($user->hasPermission('admin')){
echo '<p>You are the admin</p>';
********I want to show lecturer dive here*************
}
}else {
echo '<p>You need to <a href="login.php">login</a> or <a href="register.php">register</a>';
}
答案 0 :(得分:0)
尝试:
<?php
require_once 'core/init.php';
$user = new User();
if($user->isLoggedIn()) {
?>
<li><a href="logout.php">Log Out</a></li>
<div class="lecturer" id="lecturer" style="display: none;">
<label for="studentID">Student ID</label>
</div>
<?php
if($user->hasPermission('admin')){
echo '<p>You are the admin</p>';
echo '<div>Lecturer</div>';
}
}else {
echo '<p>You need to <a href="login.php">login</a> or <a href="register.php">register</a>';
}