Just_alive 发表于 2012-7-16 16:48:07

关于创建核心类MY_Controller

有点疑问,创建一个没有问题class MY_Controller extends CI_Controller

class example extends MY_Controller
如果是多个
class MY_Controller1 extends CI_Controller
class MY_Controller2 extends CI_Controller
.。。。
这样在controllers中继承MY_Controller1或者MY_Controller2都会是 class not found
这是因为CI不允许这样做呢(为什么),或者是我写错了的原因

大道达人 发表于 2012-7-16 17:25:01

你可以参考下源代码,你实际上是没有加载到文件的
      // Load the base controller class
      require BASEPATH.'core/Controller.php';

      function &get_instance()
      {
                return CI_Controller::get_instance();
      }
      if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
      {
                require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
      }

Just_alive 发表于 2012-7-16 18:48:43

大道达人 发表于 2012-7-16 17:25 static/image/common/back.gif
你可以参考下源代码,你实际上是没有加载到文件的

懂了,谢谢啊{:3_53:}
页: [1]
查看完整版本: 关于创建核心类MY_Controller