0

I make a core controller in HMVC Codeigniter and extend with another core controller but when I call these controllers there was an error show controller not found

Core controller:-

class Ugmt_Controller extends User_Controller
{
    public function __construct()
    {
        parent::__construct('user_type', 3);
    }
}

Main controller:-

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

class Ugmt extends Ugmt_Controller
{
    public function index()
    {

    }
}

Fatal error: Class 'Ugmt_Controller' not found in /var/www/html/new-ip/application/modules/ugmt/controllers/Ugmt.php on line 4
A PHP Error was encountered
Severity: Error
Message: Class 'Ugmt_Controller' not found
Filename: controllers/Ugmt.php
Line Number: 4
Backtrace:

Rahul
  • 18,271
  • 7
  • 41
  • 60
  • 2
    Possible duplicate of [Class not found showing Php](https://stackoverflow.com/questions/55511242/class-not-found-showing-php) – Yassine CHABLI Jun 03 '19 at 11:12
  • Is the filename of your Ugmt_Controller actually Ugmt_Controller.php. The Case of the file name and class name is Important. At least they must be the same. – TimBrownlaw Jun 03 '19 at 12:52

1 Answers1

0

May be it can help you... Put this code in config.php at the last

function my_own_controllers($class) {
  if (strpos($class, 'CI_') !== 0)
  {
    if (is_readable(APPPATH . 'core/' . $class . '.php'))
    {
      require_once(APPPATH . 'core/' . $class . '.php');
    }
  }
}

spl_autoload_register('my_own_controllers');