- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
只是想提一下,我真的是 API 开发(概念、结构、最佳实践)方面的新手,我对它一点也不熟悉,所以如果你觉得我是这样,请原谅我可悲的愚蠢问题,我'我使用 Phil Sturgeon 的 REST API 服务器、Curl 库和 REST API 客户端,这是我的代码:
在我的 Controller application/controllers/make_key
function index(){
$this->load->library('rest');
$this->load->library('curl');
$this->rest->put('https://www.myapplication.com/apifolder/key/X-API-KEY/FOO');
}
- 完全没有反应
其中 apifolder/key 是我的 key.php 的位置(来自 Phil Sturgeon 的默认示例):
请注意,我也通过地址栏尝试过此操作:
https://www.myapplication.com/apifolder/key/X-API-KEY/FOO- 返回({“status”:false,“error”:“无效的 API key 。”})
https://www.myapplication.com/apifolder/key?X-API-KEY=FOO - 返回 ({"status":false,"error":"Unknown method."})
并尝试了很多查询,但似乎都没有用,我唯一的问题是......
如何使这个 key.php 工作?对于这样一个简单的问题,我深表歉意,在此先感谢您
最佳答案
关于我自己的问题,请参阅我自己接受的答案...Phils 文档不提供此信息。我不得不自己深入图书馆。
i ended up finding out the 403 forbidden was because i was not providing an api key to generate keys..
Kind of abiguous as Phil's documentation doesn't state that an existing api key is required before you can generate keys.. I simply created a bogus key in the table in the db and referenced that when calling/key/index?X-API-KEY=boguskey
CodeIgniter REST API Library Ajax PUT throwing 403 Forbidden
关于codeigniter - 如何在 Codeigniter 的我自己的 Controller 中生成 API key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11625250/
我是一名优秀的程序员,十分优秀!