简体   繁体   English

在PHP中基于用户级别限制用户的方法

[英]Ways of restrict user based on user level in PHP

I have seen Joomla using many types of user access for the admin site. 我已经看到Joomla对管理站点使用了多种类型的用户访问权限。 For example user, admin user, registered user and super user. 例如,用户,管理员用户,注册用户和超级用户。 The system actually know what type of user you are once we logged in. I'm trying to do the same thing for my web app. 我们登录后,系统实际上知道您是哪种类型的用户。我正在尝试对我的Web应用程序执行相同的操作。 I need any suggestions on how this features can be achieved using PHP. 我需要有关如何使用PHP实现此功能的任何建议。

Assuming a user is in a database, you could have an column like role which would be user, admin, registered, and super. 假设一个用户在数据库中,您可能会有一个类似于role的列,该列将是user,admin,registered和super。

Then in PHP you can use switch / if-condition blocks based on that role variable. 然后在PHP中,您可以基于该role变量使用switch / if-condition块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM