shamon shamsudeen
shamon shamsudeen

Reputation: 5858

Codeigniter 3 HMVC: unable to load session library

Here is the folder structure in modules library

  1. users->controllers->Users.php

    users->config->autoload.php

  2. welcome->controllers->Welcome.php

autoload.php

$autoload = array(
    'helper'    => array('url', 'form'),
    'libraries' => array('session')
);

Welcome.php (located in modules/welcome/Welcome.php)

class Welcome extends MX_Controller {
    
   public function index()
    {
       //load module
       $this->load->module(array('users'));
    }
}

I will get the following error :

Unable to locate the specified class: Session.php

Note: url and form libraries are loaded correctly

Upvotes: 0

Views: 1352

Answers (2)

Ganpat Thakor
Ganpat Thakor

Reputation: 63

please load session in index function

$this->load->library('session');

Add this part in your function

Upvotes: 0

Gopal Satpati
Gopal Satpati

Reputation: 136

In config/autoload.php file put below line

$autoload['libraries'] = array('database','form_validation','session');   

Its work fine for me.

Upvotes: 0

Related Questions