I don't understand why, but seems that the code doesn't find the model created.
This is my index.php file structure:
<?php
require_once("class/settings.php");
$this->load->model('impostazioni_model');
$this->impostazioni_model->load_colours();
?>
and this is the model impostazioni
, settings.php
class
<?php if ( ! defined('BASEPATH')) exit('Esecuzione diretta dello script non consentita.');
require_once("class/config.php");
class Impostazioni_Model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
public function load_colours()
{
echo "example";
}
}
?>
the config.php
contains the details of the connection, is simple a definition of the connection paramters like host, user, password and database. What is wrong in my code?
To start with, Impostazioni_Model
should be Impostazioni_model
Model :
Class names must have the first letter capitalized with the rest of the name lowercase.
The file name must match the class name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.