Class 在CodeIgniter中,控制器在何处启动

Class 在CodeIgniter中,控制器在何处启动,class,codeigniter,controller,Class,Codeigniter,Controller,我想知道控制器从哪里开始(我的意思是文件包括在哪里,然后加载它的类,调用它的方法)。我想知道,因为我想创建一个小修改的核心 我实际上需要的是模拟调用新的控制器。我不需要像HMVC这样的技术,但我正在做一些更简单的事情,但我真的需要模拟调用控制器,稍后可以与请求的控制器交互 我已经扩展了core的Loader类,以便能够通过Loader类调用新的控制器,但是我找不到控制器在哪里启动。它位于system/core/CodeIgniter.php中,从第317行到第360行(CodeIgniter 2

我想知道控制器从哪里开始(我的意思是文件包括在哪里,然后加载它的类,调用它的方法)。我想知道,因为我想创建一个小修改的核心

我实际上需要的是模拟调用新的控制器。我不需要像HMVC这样的技术,但我正在做一些更简单的事情,但我真的需要模拟调用控制器,稍后可以与请求的控制器交互


我已经扩展了core的Loader类,以便能够通过Loader类调用新的控制器,但是我找不到控制器在哪里启动。

它位于
system/core/CodeIgniter.php中,从第317行到第360行(CodeIgniter 2.1.0)


但是,您试图做的事情仍然没有任何意义。

它位于第317行到第360行的
system/core/CodeIgniter.php中(CodeIgniter 2.1.0)

不过,你想做什么仍然毫无意义

/*
 * ------------------------------------------------------
 *  Call the requested method
 * ------------------------------------------------------
 */
    // Is there a "remap" function? If so, we call it instead
    if (method_exists($CI, '_remap'))
    {
        $CI->_remap($method, array_slice($URI->rsegments, 2));
    }
    else
    {
        // is_callable() returns TRUE on some versions of PHP 5 for private and protected
        // methods, so we'll use this workaround for consistent behavior
        if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
        {
            // Check and see if we are using a 404 override and use it.
            if ( ! empty($RTR->routes['404_override']))
            {
                $x = explode('/', $RTR->routes['404_override']);
                $class = $x[0];
                $method = (isset($x[1]) ? $x[1] : 'index');
                if ( ! class_exists($class))
                {
                    if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
                    {
                        show_404("{$class}/{$method}");
                    }

                    include_once(APPPATH.'controllers/'.$class.'.php');
                    unset($CI);
                    $CI = new $class();
                }
            }
            else
            {
                show_404("{$class}/{$method}");
            }
        }

        // Call the requested method.
        // Any URI segments present (besides the class/function) will be passed to the method for convenience
        call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
    }