Reputation: 13416
I'm trying to use CodeIgniter REST_Controller. Following is my code.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once (APPPATH.'/libraries/REST_Controller.php');
class Test extends REST_Controller{
public function index_get() {
$this->response(array(''));
}
}
When I access http://codeigniter/index.php/test
the response
<xml><item/></xml>
is shown on the browser.
But when trying to access
http://codeigniter/index.php/test.xml
or http://codeigniter/index.php/test.html
I get a 404 error.
The documentation of the above mentioned library says that both
http://example.com/books.json
http://example.com/books?format=json
works with the library.
Can someone point out to me what I'm doing wrong?
Upvotes: 1
Views: 2720
Reputation: 259
You must call it like this
SERVER-URL/index.php/test/index
And if you have the test.php inside a folder in controllers then call it like this
SERVER-URL/index.php/test/FOLDER-NAME/index
Tahir Rauf http://www.onethatmatters.com
Upvotes: 1