0

我正在为我的网站使用 CI。在为相同的内容编写 CMS 时,我没有遇到任何问题,但是当我为用户端编写相同的内容时,我收到错误消息:“404 Page Not Found The page you request was not found。” 我究竟做错了什么??热烈欢迎任何帮助/建议。谢谢。

在控制器(model.phpl)中:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Model extends CI_Controller {
    function __construct()
        {
            parent::__construct();
            $this->load->model('user_model');
            $this->load->model('common'); 
            $this->load->model('home_model');
            $this->load->model('page_model');
    }

        function _remap($method , $params = array())
        {
            $this->menu = $this->common->createMenuArr();
            $this->index();
        }
        function index()
        {
            $data['sliderArr'] = $this->user_model->sliders();
            $this->load->view('index', $data);
        }

}

在模型(user_model.php)中:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model{
    function __construct()
        {
            parent::__construct();
            //$this->load->database(); 
    }
       function sliders()
        {
            $query = $this->db->query("SELECT slider FROM tbl_sliders ORDER BY slider_id DESC")->result_array();
            return $query;
        }

}

最后在视图中(index.php):

<div id="slideContainer">
            <div id="slideShim">
                            <?php
                                if(!empty($sliderArr))
                                {
                                    foreach($sliderArr as $slider)
                                    { ?>
                                        <a href="#"><img src="<?php echo base_url();?>images/sliders/<?php echo $slider['slider'];?>"</a>
                                   <?php }
                                }
                            ?>


        </div>
    </div>
4

1 回答 1

1

转到应用程序 -> 配置 -> 路由

并设置$route['default_controller'] = "index"; //whatever your controller name is on which you want your application to route by default

希望这可以帮助。

于 2012-08-28T08:53:50.427 回答