dongqian6484 2014-09-17 22:08
浏览 27
已采纳

Codeigniter的奇怪问题(模型问题)

I have set up a local copy of CodeIgniter and another copy on a linux machine. After installing both copies with my application, the local copy is running just fine but the linux version is showing the following error code:

Unable to locate the model you have specified: User_model

I have searched all day for the answer to this. I have tried to change the spelling on the name of the model, file name, everything that I can think of. What could i be missing that would display that error?

Thanks guys

Here is a copy of my code:

(user_model.php)

 <?php

class User_model extends CI_Model {
    public function __construct(){
        parent::__construct();
    }

    function runTest(){
        return "Testing";
    }
}
?>

(welcome.php)

class Welcome extends CI_Controller {
public function __construct(){
    parent::__construct();
}
public function index()
{
    $this->load->model('User_Model');
    $data['testing'] = $this->user1234->runTest();
    $this->load->view('welcome_message', $data);
}

}

  • 写回答

3条回答 默认 最新

  • douerqu2319 2014-09-18 04:33
    关注

    It is because of case sensitivity. First of all you should keep all file names in small letters ( user_model.php ) and then use that name in controller ( $this->load->model('user_model'); ) .

    It must work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?