tp5---auth权限搭建2

1、auth权限
composer auth库

下载完成之后

根据auth.php中所提及怎样创建表,就怎样建表

2、安利一个简单的建表操作
根据composer下载里的文件注释的代码,将其直接放到sql编辑器里就好

CREATE TABLE think_auth_rule (
id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
name char(80) NOT NULL DEFAULT '',
title char(20) NOT NULL DEFAULT '',
type tinyint(1) NOT NULL DEFAULT '1',
status tinyint(1) NOT NULL DEFAULT '1',
condition char(100) NOT NULL DEFAULT '', # 规则附件条件,满足附加条件的规则,才认为是有效的规则
PRIMARY KEY (id),
UNIQUE KEY name (name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE think_auth_group (
id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
title char(100) NOT NULL DEFAULT '',
status tinyint(1) NOT NULL DEFAULT '1',
rules char(80) NOT NULL DEFAULT '',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE think_auth_group_access (
uid mediumint(8) unsigned NOT NULL,
group_id mediumint(8) unsigned NOT NULL,
UNIQUE KEY uid_group_id (uid,group_id),
KEY uid (uid),
KEY group_id (group_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

修改配置config.php

posted @ 2018-01-06 17:07  guoyinglichong  阅读(1543)  评论(1编辑  收藏  举报