Google News
logo
CodeIgniter - Interview Questions
Explain model in CodeIgniter.
Model's responsibility is to handle all data logic and representation and load data in the views. It is stored in application/models folder.
 
The basic structure of a model file :
class ModelName extends CI_Model {
  function_construct()
        {
          parent::_construct();
        }
}     
Here, ModelName is the name of your model file. Remember, the class first letter must be in an uppercase letter followed by other lowercase letters, and it should be the same as your file name. It extends the base CodeIgniter Model so that all the built-in methods of parent Model file gets inherited to the newly created file.
Advertisement