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
不知是何故?望高手指导指导。 parent::__construct()
请阅读CI2.0更新日志 并且scaffolding也在2.0中被废除 谢谢,刚才看了一下system中的core目录,发现其中的Controller.php文件中无CI_Controller也无Controller,只有一个__construct() 他是继承了CI_Controller这个类,然后调用父类的__construct()方法吗? 回复 3# jeongee
不好意思,新手,可不可以弱弱地问一下,更新日志在哪里呀? 回复 6# duanshanbin
:ohttp://codeigniter.org.cn/user_guide/changelog.html 回复 7# jeongee
谢谢! 手册很重要 、、、 2.01不支持php4了,构造函数要改成:
function __construct()
{
parent::__construct();
}
页:
[1]