codeigniter 进入首页显示404错误 找不到该页面
进入首页显示404错误 找不到该页面 控制器加载视图首页 不显示<?php
class home extends CI_Controller {
function __construct(){
parent::__construct();
$this->load->helper('url');
}
function index(){
$data['title']='CI开发新闻系统';
$this->load->view('header',$data);
$this->load->view('index');
$this->load->view('footer');
}
}
以上是控制器加载首页视图的代码 是否错误
这个是最新版本codeigniter 的 目录 感觉有点乱是不是路径问题 function index(){
$data['title']='CI开发新闻系统';
$this->load->view('header',$data);
$this->load->view('index');
$this->load->view('footer');
}
=========================
上面这里你改成
function index(){
$data['title']='CI开发新闻系统';
$this->load->view('index');
}
然后在view里面的index页面加载header和footer $this->load->view('header',$data);
$this->load->view('index');
$this->load->view('footer');
应该不会有问题 只是个人觉得, 没有实战,不过你的三个view文件路径是否有问题及文件本身命名 1、你访问的路径是怎么写的,是例如 localhost还是localhost/index.php.
2、你的默认的controller是否设了,是在confie/routes.php里
3、你最好先用CI自带的那个welcome试一下,排除是你的index的问题。 是不是url rewrite 没有开启?/index.php?c=welcome&m=index,/welcome/index应该一样的,index.php?c=welcome&m=index2012 ,应该是出不来的,404页面。
页:
[1]