路由问题
我在routes.php里面$route['default_controller'] = "index";cntroller里面的index.php写
<?php
class Index extends CI_Controller {
public function index()
{
$this->load->view('index/index');
}
}
view里面都有对应的文件,访问时候就有下面错误:
A PHP Error was encounteredSeverity: Notice
Message:Undefined property: Index::$load
Filename: controllers/index.php
Line Number: 6
Fatal error:Call to a member function view() on a non-object in D:\Code\ci\a\controllers\index.php on line 6
如果都把对应的index改为home的话就没有错误,请问这是什么问题?
class Index extends ,Index是保留字
详情:
http://codeigniter.org.cn/user_guide/general/reserved_names.html 但是我下载别人的作品这样写是可以的,莫非在其他地方做了手脚? gxseanjiang 发表于 2011-6-20 10:31 static/image/common/back.gif
但是我下载别人的作品这样写是可以的,莫非在其他地方做了手脚?
没,你要加个
function __construct()
{
parent::__construct();
}
谢谢指教!!
页:
[1]