ThinkPhp RBAC experience_PHP tutorial

WBOY
Release: 2016-07-13 17:47:37
Original
1100 people have browsed it

-

Thinkphp is a good Php development framework. I used it to help me develop a physical management system some time ago. Since this is the first time I use him to develop something, everything is very unfamiliar, and I have to read the documents one by one for many things. Fortunately, the task was finally completed. Let’s share the development experience of RBAC.

Role-Based Access Control

I won’t go into details about how to use Thinkphp’s RBAC, how to build and fill in tables, there are many on the Internet. What I want to say here are some suggestions when writing code using Thinkphp+RBAC.

I once read the code of phpcms9v and found some good practices in implementing the mvc mode, so I wrote them down. When I first started using thinkphp, I found that the same approach was used. I was a little excited, thinking that writing code would be very convenient. Then I start writing on the keyboard. It wasn't until I finished writing most of the code that I discovered that I encountered a problem when defining the RBAC data table. Because there are many permissions that should be indivisible in one operation, but I have to separate them; there are many operations in one class, so I don’t know which ones are used to receive requests...

Then I thought about it...it seems that there are a lot of things that I haven't used yet, and I'm just lazy...

For example?act=submit

Originally, form submission could be written in one action, so I just wrote two /index.php/Index/submit. . .

When writing the data table, the two have to be separated...

So I suggest that when you write RBAC programs in the future, put the actions that require the same permissions in a function, so that it will be much more convenient when defining RBAC. . .

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478493.htmlTechArticle- Thinkphp is a good Php development framework. I used it to help me develop a physical object management system some time ago. . Since this is the first time I use him to develop things, everything is very unfamiliar and a lot...
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!