duanmangxie7131
duanmangxie7131
2012-11-06 13:27

CodeIgniter RESTful API速率限制问题

  • codeigniter
  • php
  • api

I am working with the following code written by Phil Sturgeon here: https://github.com/philsturgeon/codeigniter-restserver

No where in his docs can I see how the limit option is setup in side of the controller.

the RESTController controller file has some references e.g.

Line 654: https://github.com/philsturgeon/codeigniter-restserver/blob/master/application/libraries/REST_Controller.php

Shows the protected function, additionally there is:

 // How many times can you get to this method an hour?
 $limit = $this->methods[$controller_method]['limit'];

And from the rest.php config:

/* |-------------------------------------------------------------------------- | REST Enable Limits |-------------------------------------------------------------------------- | | When set to true REST_Controller will count the number of uses of each method | by an API key each hour. This is a general rule that can be overridden in the | $this->method array in each controller. |

Can anyone help me with this please? Pulling my hair out currently :-)

One of my controllers methods as it currently stands:

function listservices_get()
{
    $organisation_id = $this->get('id');
    $organisations = $this->api_buyus_model->list_services($organisation_id);

    if($organisations)
    {
            $this->response($organisations, 200);
    }
    else
    {
            $this->response(array('error' => '1', 'errorDesc' => 'Buy us services list could not be retrieved.'), 400);
    }
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐