duanshanbin 发表于 2011-4-2 17:52:43

parent:Controller()出错。

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Blog extends CI_Controller{
function Blog()
{
parent::Controller();
$this->load->scaffolding('entries');
}
function index()
{
$data['title']="My Blog Title";
$data['heading']="My Blog Heading";
$data['todo']=array('clean house','eat lunch','call mom');
$this->load->view('blog_view',$data);
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
?>
我下的是2.0.1版本。
运行提示:
Fatal error: Call to undefined method CI_Controller::controller() in G:\AppServ\www\codeigniter\application\controllers\blog.php on line 6
不知是何故?望高手指导指导。

jeongee 发表于 2011-4-2 17:54:36

parent::__construct()

请阅读CI2.0更新日志

jeongee 发表于 2011-4-2 17:55:21

并且scaffolding也在2.0中被废除

duanshanbin 发表于 2011-4-2 17:57:18

谢谢,刚才看了一下system中的core目录,发现其中的Controller.php文件中无CI_Controller也无Controller,只有一个__construct()

duanshanbin 发表于 2011-4-2 17:58:47

他是继承了CI_Controller这个类,然后调用父类的__construct()方法吗?

duanshanbin 发表于 2011-4-2 18:01:24

回复 3# jeongee


    不好意思,新手,可不可以弱弱地问一下,更新日志在哪里呀?

jeongee 发表于 2011-4-2 18:19:51

回复 6# duanshanbin


   :ohttp://codeigniter.org.cn/user_guide/changelog.html

duanshanbin 发表于 2011-4-6 11:08:25

回复 7# jeongee


    谢谢!

wbgod_1987 发表于 2011-4-8 13:10:26

手册很重要 、、、

sd49124800 发表于 2011-4-11 13:53:33

2.01不支持php4了,构造函数要改成:

function __construct()
{
   parent::__construct();
}
页: [1]
查看完整版本: parent:Controller()出错。