ci里想自己写个基类控制器
( ! ) Fatal error: Class 'MY_C' not found in D:\wamp\www\m.kkguo\application\controllers\show.php on line 8Call Stack#TimeMemoryFunctionLocation10.0003386848{main}()..\index.php:020.0010459872require_once( 'D:\wamp\www\m.kkguo\system\core\CodeIgniter.php' )..\index.php:20230.01401376512include( 'D:\wamp\www\m.kkguo\application\controllers\show.php' )..\CodeIgniter.php:250报错!
首先我在application/core/ 中建了一个MY_C.php
里面代码如下:
<?php
/**
* Description of MY_C
* @author zaodian
* @version 2012-5-15 15:31:41
*/
class MY_C extends CI_Controller{
function __construct()
{
parent::__construct();
}
}
接着,我在application/controller/建了一个show.php
<?php
/**
* Description of show 新闻显示页
* @author zaodian
* @version 2012-5-14 11:49:40
*/
class Show extends MY_C{
}
然后就报错了,说找不到.
是哪里有配置 没写对吗?
我是对着这手册里做的http://codeigniter.org.cn/user_guide/general/core_classes.html 名字一定要MY_Controller 类的名字和文件名同名 米修 发表于 2012-5-15 16:18 static/image/common/back.gif
名字一定要MY_Controller 类的名字和文件名同名
是同名的MY_C.php->class MY_C 还真不好用啊啊啊,没TP灵活 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';
}
CodeIgniter.php可以根据你的需求修改名字,不一定非要MY_Controller.php
页:
[1]