Xml 如何在restfulcodeigniter中使用rest\u enable\u访问?

Xml 如何在restfulcodeigniter中使用rest\u enable\u访问?,xml,codeigniter,rest,Xml,Codeigniter,Rest,1)在BD中创建一个名为“ci\U api\U access”的表: CREATE TABLEci\u api\u access( |idINT(11)无符号非空自动增量, |keyVARCHAR(40)非空默认值“”, |controllerVARCHAR(50)非空默认值“”, |date\u创建日期DATETIME默认为空, |date\u modifiedTIMESTAMP NOT NULL更新当前时间戳时的默认当前时间戳, |主键(id) |)引擎=InnoDB默认字符集=utf8 2

1)在BD中创建一个名为“ci\U api\U access”的表:

CREATE TABLE
ci\u api\u access
(
|
id
INT(11)无符号非空自动增量,
|
key
VARCHAR(40)非空默认值“”,
|
controller
VARCHAR(50)非空默认值“”,
|
date\u创建日期
DATETIME默认为空,
|
date\u modified
TIMESTAMP NOT NULL更新当前时间戳时的默认当前时间戳,
|主键(
id
)
|)引擎=InnoDB默认字符集=utf8

2将“rest\u enable\u access”]设置为TRUE:

/*
|--------------------------------------------------------------------------
| REST Method Access Control
|--------------------------------------------------------------------------
| When set to TRUE, the REST API will check the access table to see if
| the API key can access that controller. 'rest_enable_keys' must be enabled
| to use this
|
| Default table schema:
|   CREATE TABLE `access` (
|       `id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
|       `key` VARCHAR(40) NOT NULL DEFAULT '',
|       `controller` VARCHAR(50) NOT NULL DEFAULT '',
|       `date_created` DATETIME DEFAULT NULL,
|       `date_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|       PRIMARY KEY (`id`)
|    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
*/

$config['rest_enable_access'] = FALSE;
3在表ci\u api\u中插入任何值:

(样本)

观看本教程,了解如何保护API:

重要提示: REST访问控制方法的控制器名称有问题,您需要按照以下说明进行修复:

创建表访问,但我不知道如何将其用于我的web服务
$config['rest_enable_access'] = TRUE;
INSERT INTO ci_api_access id, key, controller, date_created, date_modified 
VALUES ('', 'YOUR_KEY', 'YOUR_CONTROLLER_NAME', '2016-04-02 00:00:00', '2016-04-02 00:00:00');