public function view($page = 'home') //文档错误
在线文档中http://codeigniter.org.cn/user_guide/tutorial/static_pages.htmlpublic function view($page = 'home')
{
if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{ // 页面不存在
show_404();
}
$data['title'] = ucfirst($page);
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
// echo $this->load->view('pages/'.$page, $data,true);
$this->load->view('templates/footer', $data);
}
设置好routes.php.
访问:http://localhost/index.php/home.php//显示正常
访问:http://localhost/index.php/about.php//仍显示home.php的内容???,echo了一下,接收到都是home
刚试过,没有问题 建议最开始学,先不学路由那块,不然搞复杂了
页:
[1]