dswy34539 2015-08-30 16:48
浏览 42
已采纳

CodeIgniter不会在部署机器上加载模型

I developed a small application with Codeigniter and brought it to run with vagrant and Debian. And everything was fine.

So now I'm trying to set up a virtual machine with Xubuntu 15.04. Installed the same packages (PHP as an Apache module)

Now I'm getting the following error:

Unable to locate the model you have specified: Person_model

This is how I load my model:

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

And this is how my model actually looks like in models/person_model.php

<?php

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

  // ...
}

On Xubuntu I'm running PHP 5.6.4-4ubuntu6.2 and on Debian I'm running PHP 5.4.41-0+deb7u1

Thanks for any advice and help!

  • 写回答

2条回答 默认 最新

  • dongzhiju0324 2015-08-30 22:53
    关注

    Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers and models) must be named in a Ucfirst-like manner or in other words - they must start with a capital letter. http://www.codeigniter.com/user_guide/installation/upgrade_300.html#step-2-update-your-classes-file-names

    This is CodeIgniter 3.0 coding convention which you must follow. So your model file should be models/Person_model.php.

    Probably you use case insentive file system (host OS is like Windows or Mac) with Vagrant shared folder . And you don't use Vagrant shared folder with Xubuntu, don't you?

    Anyway, this is problem with file system, not PHP version nor OS.

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

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?