我打算使用REST_Controller.php來製作其餘的api。上調用 本地主機/ rest_api_ci/API /示例/用戶/ 1REST_Controller.php在codeigniter中不起作用
顯示(使用笨V3上ubnatu 15)
從鏈路https://github.com/chriskacerguis/codeigniter-restserver
Me錯誤
Fatal error: Class 'REST_Controller' not found in /var/www/html/rest_api_ci/application/controllers/api/Example.php on line 21
一看Example.php文件
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require(APPPATH.'libraries/REST_Controller.php');
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author Phil Sturgeon, Chris Kacerguis
* @license MIT
* @link https://github.com/chriskacerguis/codeigniter-restserver
*/
class Example extends REST_Controller {
function __construct()
{
你在哪裏放置rest_controller .php在你的項目中? –
庫/ REST_Controller.php一切都在正確的地方。我使用.htaccess文件刪除index.php –
所以你的網址必須是http://localhost/rest_api_ci/index.php/api/Example/users –