php - Why construct function creates issue in codeigniter 3? -


i new codeigniter 3.x, in codeigniter 3.x when write

class auth extends ci_controller {      public function __construct() {         parent::__construct();         echo "ya";     } } 

it shows me error

404 page not found  page requested not found. 

and when write

class auth extends ci_controller {      public function __construct() {         parent::__construct();         echo "ya";     }     public function index() {         echo "aya";exit;     } } 

it works fine , shows output {yaaya}. can let me know y this?

the reason behind when run url

http://ip/cifolder/index.php/controller

by default index() of controller

if use url like

http://ip/cifolder/index.php/controller/function

it function of controller

and if not written function in controller __construct

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

it means no index() function show 400 error


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -