CI_Loader::model()

model($model[, $name = ''[, $db_conn = FALSE]])

Parameters:
  • $model (mixed) – Model name or an array containing multiple models
  • $name (string) – Optional object name to assign the model to
  • $db_conn (string) – Optional database configuration group to load
Returns:

CI_Loader instance (method chaining)

Return type:

CI_Loader

$this->load->model('model_name');

If your model is located in a subdirectory, include the relative path from your models directory. For example, if you have a model located at application/models/blog/Queries.php you’ll load it using:

$this->load->model('blog/queries');

If you would like your model assigned to a different object name you can specify it via the second parameter of the loading method:

$this->load->model('model_name', 'fubar');
$this->fubar->method();
doc_CodeIgniter
2016-10-15 16:31:45
Comments
Leave a Comment

Please login to continue.