php - Fatal error: Class 'MY_Controller' not found when checking session at all controller method in Codeigniter -


i working on codeigniter , following link codeigniter check user session in every controller check session @ every controller, have created my_controller.php inside libraries folder

<?php  class my_controller extends ci_controller {     public function __construct()     {         parent::__construct();     }      public function is_logged_in()     {         $user = $this->session->userdata('logged_in');         return isset($user);     } }   ?> 

create_check.php

class create_check extends my_controller {  public function __construct() { parent::__construct(); }  public function edit_getting_started($c_id) {     if ($this->is_logged_in())     {     $course_data['result']=$c_id;     $this->load->view('goal',$course_data);     }     else     {     // go login page.     } } } 

when run create_check/edit_getting_started/3 following error :

fatal error: class 'my_controller' not found in

i'm new codeigniter not have knowledge want standard approach check session @ every page. please solve problem.can put check in controller construct method seen in link codeigniter - how check session used @ every methods

to extend core class, must put extension (the my_controller.php file in case) under core/, not libraries/.

link manual explaining this: http://www.codeigniter.com/userguide3/general/core_classes.html#extending-core-class


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -