我在下面有这个PHP代码,限制2级或更高级别的用户能够看到这个特定的网页。
但是我想仅将其限制为具有此网页的级别为2和级别7的用户,因为我也有级别为1,3和4的用户(级别7是管理员)。
我不希望有1,3或4的用户能够登录此网页。我尝试过使用“==2||== 7“,但我无法让它正常工作。
如何编写PHP代码才能正常工作?
<!-- User with account type 2 or higher -->
<!-- But want user with account type 2 and 7 only -->
<?php if (Session::get("user_account_type") >=2 ): ?>
<li <?php if (View::checkForActiveController($filename, "project")) { echo ' class="active" '; } ?> >
<a>Projekt</a>
<ul class="navigation-submenu">
<li <?php if (View::checkForActiveController($filename, "project")) { echo ' class="active" '; } ?> >
<a href="<?php echo Config::get('URL'); ?>project/alfa">Project Alfa</a>
</li>
<li <?php if (View::checkForActiveController($filename, "project")) { echo ' class="active" '; } ?> >
<a href="<?php echo Config::get('URL'); ?>project/delta">Project Delta</a>
</li>
</ul>
</li>
<?php endif; ?>
这是管理员级别的页面
<!-- User with admin level 7 -->
<?php if (Session::get("user_account_type") == 7) : ?>
<li <?php if (View::checkForActiveController($filename, "admin")) { echo ' class="active" '; } ?> >
<a href="<?php echo Config::get('URL'); ?>admin/">Admin</a>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>
慕田峪7331174