新手遇困3天了, Class 'CI_Controller' not found
本帖最后由 xygs888 于 2012-1-15 11:20 编辑求大侠们帮助吖
Fatal error: Call to undefined method CI_Controller::controller() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ci\application\controllers\navgate.php on line 7
代码
<?php
class Blog extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
echo '你好,世界!';
}
function comments()
{
echo '看这里!';
}
}
?> 什么版本? 2.10。。超级不解 贴上代码,是看视频 20分钟blog的,完全一样的<?php
class Blog extends CI_Controller {
function Blog()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
public function index()
{
//$this->load->view('welcome_message');
$data['title']="My blog title";
$data['heading']="My blog heading";
$data['query']=$this->db->get('entries');
$this->load->view('blog_view',$data);
}
function comments()
{
$data['title']="My Comment Title222";
$data['heading']="My Comment Heading222";
$this->load->view('comment_view',$data);
}
function comment_insert()
{
$this->db->insert('comments',$_post);
redirect('blog/comments/'.$_POST['entry_id']);
}
}
?>
xygs888 发表于 2012-1-12 11:05 static/image/common/back.gif
贴上代码,是看视频 20分钟blog的,完全一样的
贴上目录结构看看。 \controllers\navgate.php
但是你的class为啥是Blog,应该是class Navgate 文件名和类名要一致 parent::Controller();也错了 谢谢,解决了 xygs888 发表于 2012-1-12 16:29 static/image/common/back.gif
谢谢,解决了
怎么解决的?我也遇到了类似的问题
页:
[1]
2