APPPATH代码信号器在服务器上不工作

APPPATH代码信号器在服务器上不工作

本文介绍了APPPATH代码信号器在服务器上不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  

我有一个问题在codeigniter上传到服务器,我需要一个模型文件><?php
require_once(APPPATH.'libraries / MY_Model.php');
Class scroll_news_model extends MY_model
{
public function __construct()
{
parent :: __ construct(scroll_news);
}
}

这个代码在我的localhost中正常工作,在上传后遇到此错误



致命错误:require_once()[function.require]:无法打开所需的'application / libraries / MY_Model.php'(include_path =' 。/ usr / lib / php:/ usr / local / lib / php')在/home/arab2day/public_html/temp/arab2day/application/models/scroll_news_model.php第2行


CI_Model 类, MY_Model.php 属于 / core 目录而不是 / libraries ,您不需要包括



这是扩展核心类的工作原理,扩展常规非必要的库稍有不同。有关详情,请参阅:





至于文字问题,提供了一个关于区分大小写和操作系统的好处,我自己遇到了这个问题几次。


i got a problem in codeigniter after i upload it to the server i am requiring a file in a model from libraries folder

<?php
require_once(APPPATH.'libraries/MY_Model.php');
Class scroll_news_model extends MY_model
{
 public function __construct()
 {
    parent::__construct("scroll_news");
 }
}

this code was working fine in my localhost but i keep getting this error after i upload it

Fatal error: require_once() [function.require]: Failed opening required 'application/libraries/MY_Model.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/arab2day/public_html/temp/arab2day/application/models/scroll_news_model.php on line 2

解决方案

If you are trying to extend the CI_Model class, MY_Model.php belongs in the /core directory rather than /libraries, and you don't need to include it - it will be loaded automatically when the base model class is loaded.

This is how extending core classes works, extending regular non-essential "libraries" is slightly different. Read more about it here:

http://codeigniter.com/user_guide/general/core_classes.html

As far as the literal problem goes, Lepidosteus makes a good point about case sensitivity and OS, I've run into this issue myself several times.

这篇关于APPPATH代码信号器在服务器上不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 02:30