php - Fatal error: Class not found in codeigniter -
i have created model admin_model
under application\core
directory of code igniter. put basic database operations under it. when try extend models under application\model
directory, throws error.
fatal error: class 'admin_model' not found in <path root>/application/models/new_model.php on line 3
should miss configuration?
extending core class
if need add functionality existing library - perhaps add function or 2 - it's overkill replace entire library version. in case it's better extend class. extending class identical replacing class couple exceptions:
the class declaration must extend parent class. new class name , filename must prefixed my_ (this item configurable. see below.). example, extend native model class you'll create file named application/core/my_model.php, , declare class with:
class my_model extends ci_model { }
note: if need use constructor in class make sure extend parent constructor:
class my_model extends ci_model { function __construct() { parent::__construct(); } }