已将rest.php包含在配置文件夹中
已将库文件添加到库文件夹中。
代码点火器版本正常,为3或以上
php版本ok和上述的5.4
我的控制器:
require(APPPATH . 'libraries/REST_Controller.php');
class Books_api extends REST_Controller {
public function book_get()
{
// Display all books
$this->response(array('data'=> 'test'), 200);
}
public function book_post()
{
// Create a new book
}
}
我的api调用:
http://localhost/project_name/index.php/books_api/book
method I tried is GET from postman or httpRequester
我的响应标头
-- response --
404 Not Found
Date: Mon, 04 Apr 2016 14:12:56 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Content-Length: 1130
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
我在这里做错了吗?可能是,但我想不通。请帮帮我。
我看到文件名应该是Books_api.php
,而不是books_api.php
。
这可能是一个愚蠢的错误,但应该对休息的先发球员有用。