Welcome Guest, Not a member yet? Register   Sign In
Why construct function creates issue in codeigniter 3
#1

I am new to codeigniter 3.x, in codeigniter 3.x when i write

class Auth extends CI_Controller {

    public function __construct() {
        parent::__construct();
        echo "ya";
    }
}
it shows me error

404 Page Not Found

The page you requested was not found.
and when i write

class Auth extends CI_Controller {

    public function __construct() {
        parent::__construct();
        echo "ya";
    }
    public function index() {
        echo "aya";exit;
    }
}
it works fine and shows output as {yaaya}. can anyone let me know y is this?
Reply
#2

Because CI3 tries to run Auth::index() when you navigate to `auth` or `auth/index`,
but the method does not exist. So 404 Page Not Found shows.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB