jackchow123456 / jackchow-rbac Goto Github PK
View Code? Open in Web Editor NEWa thinkphp5 rbac feature
a thinkphp5 rbac feature
RT
希望表里面默认有用户admin 角色为超级管理员
一般ID能为1 的 都是网站的超级管理员,可以避免逻辑,如果ID为1的话不管是什么都返回true或许挺不错的!
发生这个问题的主要原因是thinkphp版本较低,tp5.1才有这个方法
解决方法有两种:
一:升级thinkphp版本
二:直接把rbac/src/config中的config.php文件改成rbac.php然后放到 config 文件夹就好,不用再输入 生成配置文件的命令了。
环境:
ThinkPHP 5.024 Apache PHP7.0 版本
使用 php think rbac:publish
生成 配置文件 config/rbac.php 失败~~~
查到原因发现是不支持 Loader::getRootPath()
的原因吧!
尝试手动拷贝 config/rbac.php ,但是不懂放置到哪里??????
================
我直接拷贝 rbac.php 放置在 application/config/rbac.php
请问这样子对吗?
先不论对错,我尝试使用 php think rbac:migrate
命令报错:
Class 'think\facade\Env' not found
这是什么原因呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.