-
Thinkphp is a good Php development framework. It helped me develop a physical management system some time ago. Since it was the first time that he was used to develop things, everything was unfamiliar and many things had to go through the document one by one. Fortunately, the task was finally completed. The following describes the development experience of RBAC.
Role-Based Access Control)
I won't talk about how to use RBAC in Thinkphp, and how to create tables and fill in tokens. There are many websites on the Internet. I would like to talk about some suggestions when using Thinkphp + RBAC to write code.
I have read the phpcms9v code and found some good practices for implementing the mvc mode in it. I just noted it down. When I started using thinkphp, I found this practice. I was very excited and thought it would be very convenient to write code. Then run the keyboard and write it. It wasn't until I finished writing most of the code that I found that a problem occurred while defining the RBAC data table. Because there are a lot of permissions that should be inseparable in an operation, but I have to separate them; there are a lot of operations in a class, so that I don't know which ones are used to receive requests...
Then I thought about it... it seems that I haven't used a lot of things, so I am just waiting for laziness...
For example? Act = submit
Originally, form submission can be written into an action. I will write two/index. php/Index/submit statements...
When writing data tables, the two data tables must be separated...
So I suggest you put the action that requires the same permission in a function when writing the RBAC program. This makes it much easier to define RBAC...