Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取CodeIgniter RESTful API中的错误_Codeigniter_Codeigniter Restserver - Fatal编程技术网

获取CodeIgniter RESTful API中的错误

获取CodeIgniter RESTful API中的错误,codeigniter,codeigniter-restserver,Codeigniter,Codeigniter Restserver,错误图像 这是我的休息控制器 嗨,我在制作Codeigniter RESTful API时出错了。请帮我解决这个问题。应该是这样的: 确保库文件夹中有REST\u Controller.php 您需要遵循链接 然后,在运行代码之后,您将遇到一个小错误,无法加载请求的语言文件:language/english/rest\u controller\u lang.php 问题是codeigniter找不到其余的控制器翻译。您只需要创建这个文件/application/languages/engli

错误图像

这是我的休息控制器


嗨,我在制作Codeigniter RESTful API时出错了。请帮我解决这个问题。

应该是这样的:

确保库文件夹中有
REST\u Controller.php


您需要遵循链接

然后,在运行代码之后,您将遇到一个小错误,无法加载请求的语言文件:language/english/rest\u controller\u lang.php

问题是codeigniter找不到其余的控制器翻译。您只需要创建这个文件/application/languages/english/rest\u controller\u lang.php

然后将此代码复制并粘贴到:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

require_once APPPATH . '/libraries/REST_Controller.php';


class Demo  extends REST_Controller
{
    function __construct(){

      parent::__construct();
    }

   public function demo1_get()
   {
     echo 'demo 1';
   }
}

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

require_once APPPATH . '/libraries/REST_Controller.php';


class Demo  extends REST_Controller
{
    function __construct(){

      parent::__construct();
    }

   public function demo1_get()
   {
     echo 'demo 1';
   }
}
<?php
/*
 * English language
 */
$lang['text_rest_invalid_api_key'] = 'Invalid API key %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Invalid credentials';
$lang['text_rest_ip_denied'] = 'IP denied';
$lang['text_rest_ip_unauthorized'] = 'IP unauthorized';
$lang['text_rest_unauthorized'] = 'Unauthorized';
$lang['text_rest_ajax_only'] = 'Only AJAX requests are allowed';
$lang['text_rest_api_key_unauthorized'] = 'This API key does not have access to the requested controller';
$lang['text_rest_api_key_permissions'] = 'This API key does not have enough permissions';
$lang['text_rest_api_key_time_limit'] = 'This API key has reached the time limit for this method';
$lang['text_rest_ip_address_time_limit'] = 'This IP Address has reached the time limit for this method';
$lang['text_rest_unknown_method'] = 'Unknown method';
$lang['text_rest_unsupported'] = 'Unsupported protocol';