用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1316|回复: 9
收起左侧

[讨论/交流] Unable to locate the specified class: setting.php

[复制链接]
发表于 2017-8-21 11:02:23 | 显示全部楼层 |阅读模式
请问这个是什么原因啊?之前2.X版本没问题,现在用3.X版本就出现这个样子了
发表于 2017-8-21 11:52:01 | 显示全部楼层
3.x 版本需要文件名大写开头。
 楼主| 发表于 2017-8-21 14:30:32 | 显示全部楼层
Hex 发表于 2017-8-21 11:52
3.x 版本需要文件名大写开头。

大写啦,还是这个问题,好奇怪哦
Unable to locate the specified class: Settings.php
发表于 2017-8-21 16:00:53 | 显示全部楼层
ranshaodemantou 发表于 2017-8-21 14:30
大写啦,还是这个问题,好奇怪哦
Unable to locate the specified class: Settings.php

贴代码看看吧,还有你的目录结构,写对了是肯定可以的。
 楼主| 发表于 2017-8-21 16:14:55 | 显示全部楼层
SYS 这个不说了
APP 里面的
  |
  ------core
             |
              ------------Lin_Controller.php
  ------libraries
             |
              ------------lin
                               |
                               ---------Settings.php

其中Lin_Controller.php 部分内容:
class Lin_Controller extends CI_Controller {
       
        public $setting;
        public $S;       
       
        //初始化扩展控制类
        function __construct(){
               
                parent::__construct();
                //载入配置
                $this->load->library('lin/Settings');

        //判断当前语言
        $this->S['lang'] =  $this->config->item('language');
        $this->S['post_lang'] = $this->config->item('post_lang');
               
        }
       
}
等等。。。

lin里Settings.php的内容
class Settings
{
内容内容。。。       
}
发表于 2017-8-21 17:16:28 | 显示全部楼层
ranshaodemantou 发表于 2017-8-21 16:14
SYS 这个不说了
APP 里面的
  |

这样试过吗 $this->load->library('lin/settings');
 楼主| 发表于 2017-8-21 17:51:14 | 显示全部楼层
Hex 发表于 2017-8-21 17:16
这样试过吗 $this->load->library('lin/settings');

试过啦,不行,好迷茫啊
发表于 2017-8-21 19:27:27 | 显示全部楼层
ranshaodemantou 发表于 2017-8-21 17:51
试过啦,不行,好迷茫啊

你的代码看起来没问题,试试不放到子目录里行不行。
 楼主| 发表于 2017-8-21 22:12:43 | 显示全部楼层
Hex 发表于 2017-8-21 19:27
你的代码看起来没问题,试试不放到子目录里行不行。

$config['enable_hooks'] = FALSE;  不启用就可以了 ,在2.X版本一切正常...
发表于 2017-8-22 10:48:27 | 显示全部楼层
ranshaodemantou 发表于 2017-8-21 22:12
$config['enable_hooks'] = FALSE;  不启用就可以了 ,在2.X版本一切正常...

有一些人报告过这个 hook 的问题,我有时间测试下吧。

本版积分规则