0

Controller filename is Auth.php

class Auth extends MY_Controller {

    public function __construct() {
        parent::__construct();

    //load model
    $this->load->model('Auth_model', 'auth');
    $this->load->model('Mail', 'mail');
    $this->load->library('form_validation');
}

but the following error keep appearing:

An uncaught Exception was encountered Type: Error

Message: Class 'MY_Controller' not found

Filename: C:\xampp\htdocs\codeigniter\application\controllers\Auth.php

Line Number: 16

Backtrace:

File: C:\xampp\htdocs\codeigniter\index.php Line: 315 Function: require_once

Narendra
  • 1,511
  • 1
  • 10
  • 20
  • This question has been answered many times. Try searching SO with the phrase **[codeigniter] my_controller not found** – DFriend Mar 13 '19 at 19:00

1 Answers1

0

you have to create a file like application/core/MY_Controller.php;

then post your core functions in it. (don't forget to create __construct() function

class MY_Controller extends CI_Controller
{
    public function __construct(){
        parent::__construct();
    }
} 
//your other rest codes will be here
Ali Qorbani
  • 1,254
  • 8
  • 27
  • This won't help. The constructor is pointless in your example. A call to the parent constructor is only needed when the child class overrides the parent's `__construct()` method. – DFriend Mar 13 '19 at 18:55