嗨,我有如下配置设置:
$config['auth_override_class_method_http']['admin']['auth']['post'] = 'none';
我正在为我的HMVC使用此库:https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc
但是当我检查REST_Controller.php
上的错误处理时
似乎REST无法识别/ admin / auth
这是我的REST代码:
<?php
use Restserver\libraries\REST_Controller;
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 */
//To Solve File REST_Controller not found
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';
class Auth extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
$this->load->model('Auth_model','Entity_model');
//$this->load->library('form_validation');
$this->load->library('validation');
header('access-control-allow-origin: *');
header("access-Control-Allow-Methods: GET,POST,OPTIONS,PUT,DELETE");
}
public function index_get()
{
$return_message = [
'error' => 102,'message' => "Entity Not Found"
];
$this->set_response($return_message,REST_Controller::HTTP_NOT_FOUND);
}
public function index_post()
{
/* Request,Response https://i.vgy.me/APy9PT.png */
$message = [
'status' => true,'error_code' => 102,'error_message' => 'success'
];
$this->set_response($message,REST_Controller::HTTP_CREATED);
// CREATED (201) being the HTTP response code
}
}
尽管我所有的GET / POST请求都可以正常工作,因为它应该在端点上。
有人能建议我该怎么做才能使它工作,即
我想对多个API请求使用身份验证,但不希望对admin / auth [POST]
使用身份验证