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 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教