首页 > 解决方案 > 找不到型号

问题描述

无法找到您指定的模型:Empresa_model

文件名:/opt/lampp/htdocs/actzap_CI/system/core/Loader.php

我已经多次编写此代码,但问题仍然存在,有人可以帮忙吗?对不起,我的英语不好

模型:

    class Empresa_model extends CI_Model {
        //...
        function __construct(){
              parent::__construct();
        }

        public function listaEmpresas(){

            return $this->db->get("empresa")->result_array();
        }
        //...
    }

控制器:

class Empresa_controller extends CI_Controller

    public function index()
    {
        $this->load->model('empresa_model');

        $lista = $this->empresa_model->listaEmpresas();

        $dados = array("empresa" => $lista);

        $this->template->show('empresa', $dados);
    }
    //...
}

完全错误:

An uncaught Exception was encountered
Type: RuntimeException

Message: Unable to locate the model you have specified: Empresa_model

Filename: /opt/lampp/htdocs/actzap_CI/system/core/Loader.php

Line Number: 348

Backtrace:

File: /opt/lampp/htdocs/actzap_CI/application/controllers/Empresa_controller.php
Line: 9
Function: model

File: /opt/lampp/htdocs/actzap_CI/index.php
Line: 315
Function: require_once

标签: phpcodeigniter

解决方案


推荐阅读