Home  >  Article  >  Backend Development  >  PHP implements simple permission management

PHP implements simple permission management

高洛峰
高洛峰Original
2016-12-02 10:55:021817browse

<?php
/*
权限设计
有一个全局的管理员root
每个栏目有个管理员权限为其他权限的合
每单个权限为2的倍数
list/read 1
add       2
edit      2
del       4
all       admin
*/
if( 5&2)
{
 echo 1;
}else{
 echo 0;
}
/*
简单的权限管理,有这个基本就够用了, 
不做更复杂的了,功能设计上不用考虑权限,
编码的遵循一些规范,在顶层类里,加个适配器
*/
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn