【发布时间】:2016-12-28 07:39:20
【问题描述】:
我将使用REST_Controller.php 来制作rest api。 (在 ubnatu 15 上使用 codeigniter v3)
来自链接https://github.com/chriskacerguis/codeigniter-restserver
通话时 localhost/rest_api_ci/api/example/user/1
显示错误
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放在你项目的什么地方?
-
libraries/REST_Controller.php 中的一切都在正确的位置。我正在使用 .htaccess 文件删除 index.php
-
如果你在本地工作
-
@vipul sharma 你也在使用 MX_controller 吗?
标签: codeigniter