Reputation: 11
I have a Problem With CodeIgniter 3 HMVC (I use CI 3.1.9 AND php 7.3), When I Create
MYX3_Controller extends MX_Controller
And i call show_404(); In my Method Will show
ERROR "Unable to locate the specified class: Session.php" like this (Look at the picture) Why don't show 404 Custom page
Upvotes: 1
Views: 748
Reputation: 1683
It usually happen when we use HMVC and we make our own custom error page. I found that we must extents MX_Controller instead of CI_Controller. And the problem should be resolved.
This an example of Cutom404 controller ( location: application/controllers/Custom404.php ) :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Custom404 extends MX_Controller { // instead of CI_controller
public function __construct() {
parent::__construct();
}
public function index()
{
$this->load->view('custom_error/custom404'); // change to your own view
}
}
?>
Upvotes: 1
Reputation: 487
It is because MX_Controller dose not have access of session. i dont know how. if you want to solve it. MX_Controller extends MY_Controller
MY_Controller has session class.
Upvotes: 0