遇到错误无法加载请求的类:Sistema[No AutoLoad]CodeIgniter


An Error Was Encountered Unable to load the requested class: Sistema [No AutoLoad] CodeIgniter

所以,我遵循了一个教程并修改了代码,但有一点我无法修复,a不明白为什么CI没有加载该类。这就是功能:

function set_theme($propriedade, $valor, $replace = TRUE){
    $ci =& get_instance();
    $ci->load->library('sistema');
    if($replace){
        $ci->sistema->theme[$propriedade] = $valor;
    }else{
        if (!isset($ci->sistema->theme[$propriedade])) {
            $ci->sistema->theme[$propriedade] = "";
        }
    $ci->sistema->theme[$propriedade] .= $valor;
   }
} // <-- end set_theme -->

sistema.php是:

<?php
class MY_Sistema{
    protected $ci;
    public $theme = array();
    public function __construct(){
        $this->ci =& get_instance();
        $this->ci->load->helper('functions');
    }
}

当我在控制器上调用set_theme()时,它只会给出错误:

An Error Was Encountered  Unable to load the requested class: Sistema

有人知道怎么修吗?

将库重命名为Sistema,并将其放入应用程序/库文件夹中

class Sistema
{
    protected $ci;
    public $theme = array();
    public function __construct(){
        $this->ci =& get_instance();
        $this->ci->load->helper('functions');
    }
}

您可以在此处找到加载库的文档