简体   繁体   中英

How can I integrate ion_auth library with CodeIgniter 3 HMVC?

I used ion_auth before in my project and I have no problem with that. Now I have a project that has an HMVC approach.

Here's what i did in my setup.

  1. I download ion_auth
  2. I put the ion_auth folder in my module and load the sql
  3. I auth load the ion_auth in my config
    • $autoload['libraries'] = array('session', 'auth/Ion_auth', 'acl');
  4. I modify the load config in the ion_auth library

    $this->load->config('auth/ion_auth', TRUE); $this->load->library(array('email')); $this->lang->load('auth/ion_auth'); $this->load->helper(array('cookie', 'language','url')); $this->load->library('session'); $this->load->model('auth/ion_auth_model');

And when I load ion_auth in my brower it says,

Unable to load the requested class: Ion_auth

And also I autoload the library in the Auth controller

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

class Auth extends MX_Controller {

    public $autoload = array(
        'libraries' => array(
            'auth/Ion_auth', 'form_validation', 'acl'
        ),
        'helper' => array(
            'url', 'language'
        )
    );

    function __construct()
    {
        parent::__construct();
        $this->load->database();

        //$this->load->library(array('auth/ion_auth','form_validation'));
        //$this->load->helper(array('url','language'));

        $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));

        $this->lang->load('auth');
    }

But still same error.

I don't know what part I missed. Can you help me?

For file structure will be as bellow. Auth file will be inside the library not in module

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM