|
楼主 |
发表于 2012-3-3 18:43:10
|
显示全部楼层
本来没有abstract修饰的,也试过,不行啊。看到cicms用了这个我也用了,还是不行。
[Sat Mar 03 18:40:47 2012] [error] [client 127.0.0.1] PHP Fatal error: Class 'M
y_Controller' not found in I:\\php\\APMServ5.2.6\\www\\htdocs\\ci1\\application\
\controllers\\blog.php on line 2
My_Controller.php
PHP复制代码 <?php
abstract class My_Controller extends CI_Controller{
function __construct()
{
parent::__construct();
}
}
?>
复制代码
blog.lphp
PHP复制代码
<?php
class Blog extends My_Controller {
function __construct (){
parent ::__construct ();
//test $this->load->database();
$this->load->model("posts_model");
//$this->load->scaffolding('posts');
}
function index (){
$data["title"]="My blog title";
$data["heading"]="My blog heading";
//$data["todo"]=array("clear house","eat lunch","call mom");
$data["posts"]=$this->posts_model->get_posts();
$this->load->view("blog_view",$data);
}
public function view ($id){
if (!$id){
show_error ("Invalid URL",404);
return;
}
$data['post']=$this->posts_model->get_posts($id);
if (empty($data['post'])){
show_404 ();
}
$data['title']=$data['post']['title'];
$data['body']=$data['post']['body'];
$this->load->view("posts/post_view",$data);
}
}
?> 复制代码 |
|