duanmangxie7131
2012-11-06 13:27
浏览 67
已采纳

CodeIgniter RESTful 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条回答 默认 最新

相关推荐 更多相似问题