|
在线文档中http://codeigniter.org.cn/user_guide/tutorial/static_pages.html
public 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
|
|