小编mao*_*r10的帖子

Codeigniter REST API 给出未知方法?

我正在使用https://github.com/chriskacerguis/codeigniter-restserver和 codeigniter。我正在尝试添加资源,并启用带有 id 的 get 方法。我添加了继承 REST_Controller 的用户控制器。我添加了几个方法,index_get,index_post。他们都完美地工作。

然后我尝试向 index_get 函数添加一个 id 参数(这样你就可以访问一个特定的用户 - 例如localhost/proj/Users/4你会给你 id 4 的用户)

class Users extends REST_Controller {

    public function index_get($id) {
        echo $id;
    }

    public function index_post() {
       echo "post";
    }

}
Run Code Online (Sandbox Code Playgroud)

然后我尝试使用邮递员访问此 get 方法: localhost/proj/index.php/users/3但它的响应是:

{“状态”:假,“错误”:“未知方法”}

知道我该如何解决这个问题吗?

php rest codeigniter

3
推荐指数
1
解决办法
8713
查看次数

在用于iPhone SDK的Youtube API中,我正在尝试获取每个搜索结果的videoID.我每次都会收到错误,我该怎么办?

这是我的代码:

  // Create a service object for executing queries
GTLServiceYouTube *service = [[GTLServiceYouTube alloc] init];
// Services which do not require sign-in may need an API key from the
// API Console
service.APIKey = @"AIzaSyD9pvsUtnegJvwv5z5XrBO5vFTBVpErYN8";
// Create a query
GTLQueryYouTube *query = [GTLQueryYouTube queryForSearchListWithPart:@"id"];
query.maxResults = 50;
query.q = @"hiking boots";
//query.country = @"US";
// Execute the query
GTLServiceTicket *ticket = [service executeQuery:query
                               completionHandler:^(GTLServiceTicket *ticket, id object, NSError *error) {
                                   // This callback block is run when the fetch completes …
Run Code Online (Sandbox Code Playgroud)

iphone search youtube-api

0
推荐指数
1
解决办法
805
查看次数

标签 统计

codeigniter ×1

iphone ×1

php ×1

rest ×1

search ×1

youtube-api ×1