亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Home php教程 php手冊 Infinitus menu display

Infinitus menu display

Oct 12, 2016 am 09:50 AM

In development projects, the display of the backend Infinitus menu is inevitable and very common. Generally, the background menu is divided into two levels, up to three levels, but there may be multiple levels. Today I will make a record of the implementation process of the Infinitus menu.

What is done here is: Role-Based Access Control. In RBAC, permissions are associated with roles, and users obtain the permissions of these roles by becoming members of the appropriate roles. This greatly simplifies the management of permissions. In an organization, roles are created to complete various tasks, and users are assigned corresponding roles based on their responsibilities and qualifications. Users can be easily assigned from one role to another. Roles can be granted new permissions based on new requirements and system integration, and permissions can also be reclaimed from a role as needed. Character-to-character relationships can be established to encompass a wider range of objective circumstances.

First introduce the following table structure:

CREATE TABLE `sp_auth` (
`auth_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`auth_name` varchar(30) NOT NULL COMMENT 'permission name',
`action_name` varchar(30) NOT NULL COMMENT 'permission code ',
`desc` varchar(120) NOT NULL DEFAULT '' COMMENT 'Permission description',
`pid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Superior authority ID',
`sort_id` smallint(5 ) unsigned NOT NULL DEFAULT '0' COMMENT 'Permission sorting value',
`add_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Add time',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ' Update time',
`is_delete` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Whether to delete (0 not deleted | 1 deleted)',
PRIMARY KEY (`auth_id`),
UNIQUE KEY `action_name` ( `action_name`),
KEY `pid` (`pid`),
KEY `add_time` (`add_time`),
KEY `is_delete` (`is_delete`),
KEY `controller_name` (`controller_name`(6) ),
KEY `auth_name` (`auth_name`(16)),
KEY `sort_id` (`sort_id`)
) ENGINE=MyISAM AUTO_INCREMENT=113 DEFAULT CHARSET=utf8 COMMENT='Permission Table';

Processing method:

//打印無限極樹形結(jié)構(gòu)菜單展示<br>    function _reSorts($data, $pid=0)<br>    {<br>        $ret = array();<br>        foreach ($data as $k => $v) {<br>            if($v['pid'] == $pid) {<br>                $v['children'] = _reSorts($data, $v['auth_id']);<br>                $ret[] = $v;<br>            }<br>        }<br>        return $ret;<br>    }<br>//打印二級菜單的方法
function getMenuShow($data)<br>{<br>    $ret = array();<br>    if (!is_array($data)) {<br>        return false;<br>    }<br>    foreach ($data as $key => $val) {<br>        if ($val['pid'] == 0) {<br>            //再次遍歷,將第二級別的放在作為其子菜單<br>            foreach ($data as $k => $v) {<br>                if ($v['pid'] == $val['auth_id']) {<br>                    $val['children'][] = $v;<br>                }<br>            }<br>            $ret[] = $val;<br>        }<br>    }<br>    return $ret;<br>}

This way you can get the displayed menu data.

Statement of this Website
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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1488
72