REST API codeIgniter [英] Rest API codeIgniter
问题描述
我创建了一个API,我想知道什么是的网址POST形式PUT和DELETE方法?对于GETALL我知道我尝试的http://localhost/example/index.php/Api/users 和我有一个结果。还有另外一个问题,对于get方法我试过的http://本地主机/例子/指数的.php /原料药/用户/ ID / 1 。它的工作,但是当我改变ID我总是得到第一个(使用id = 1)。
感谢您的帮助。
i'm creating an API and i want to know what's the form of URL for POST PUT and DELETE method ?? for getall i know it i tried http://localhost/example/index.php/Api/users and i have a result. there is another question, for get method i tried http://localhost/example/index.php/Api/user/id/1. it work but when i change the id i always get the first one (with id=1). thank you for your help
推荐答案
您可能想看看的 https://github.com/chriskacerguis/$c$cigniter-restserver 。
我一直在使用该库没有任何问题个月。
您可以设置帖子
或获得
容易,请看下面的例子:
I've been using that library for months without any problem.
You can set your posts
or gets
easily, see the following example:
public function users_get(){
$name = $this->get('name');
}
public function users_post(){
$name = $this->post('name');
}
这篇关于REST API codeIgniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!