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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题