简体   繁体   English

无法找到您指定的模型

[英]Unable to locate the model you have specified

I don't understand why, but seems that the code doesn't find the model created. 我不明白为什么,但是似乎代码找不到所创建的模型。

This is my index.php file structure: 这是我的index.php文件结构:

<?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 这是模型impostazionisettings.php

<?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. config.php包含连接的详细信息,它是对连接参数(如主机,用户,密码和数据库)的简单定义。 What is wrong in my code? 我的代码有什么问题?

To start with, Impostazioni_Model should be Impostazioni_model 首先, Impostazioni_Model应该是Impostazioni_model

Model : 型号

  1. Class names must have the first letter capitalized with the rest of the name lowercase. 类名称的首字母必须大写,其余名称小写。

  2. The file name must match the class name. 文件名必须与类名匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM