代码点火器分页不工作返回404


Codeigniter pagination not worrking returns 404

嗨,我想帮忙。我有两个控制器:movies.php和actors.php,其中我列出了所有演员和其中的所有电影。

例如,这是列出我所有电影的方法

public function index() {
        // count all movies
        $total = $this->movie_model->count();
        // set up pagination
        $per_page = 10;
        if ($total > $per_page) {
            $this->load->library('pagination');
            $config['base_url'] = site_url($this->uri->segment(1) . '/');
            $config['total_rows'] = $total;
            $config['per_page'] = $per_page;
            $config['uri_segment'] = 2;
            $this->pagination->initialize($config);
            $this->data['pagination'] = $this->pagination->create_links();
            $offset = $this->uri->segment(2);
        }
        else {
            $this->data['pagination'] = '';
            $offset = 0;
        }
        // fetch the movies
        $this->db->limit($per_page, $offset);
        $this->data['movies'] = $this->movie_model->get();
        // load the view
        $this->view('movies/index');
    } 

以及列出所有参与者

public function index() {
        // count all actors
        $total = $this->actor_model->count();
        // set up pagination
        $per_page = 10;
        if ($total > $per_page) {
            $this->load->library('pagination');
            $config['base_url'] = site_url($this->uri->segment(1) . '/');
            $config['total_rows'] = $total;
            $config['per_page'] = $per_page;
            $config['uri_segment'] = 2;
            $this->pagination->initialize($config);
            $this->data['pagination'] = $this->pagination->create_links();
            $offset = $this->uri->segment(2);
        }
        else {
            $this->data['pagination'] = '';
            $offset = 0;
        }
        // fetch the movies
        $this->db->limit($per_page, $offset);
        $this->data['actors'] = $this->actor_model->get();
        // load the view
        $this->view('actors/index');
    }

我把我的路线设置成这个

$route['default_controller'] = "movies";
$route['404_override'] = '';
$route['movies'] = 'movies/index';
$route['actors'] = 'actors/index';

网址就像这个

h**p: //localhost/www/task/public/  // for movies (default controller)
h**p: //localhost/www/task/public/actors // for actors controller

问题是,当我试图点击一个pannation链接来获取每个控制器中的下一条记录时,我会得到一个404错误。我曾尝试在分页中更改配置设置,但没有成功。

如有任何帮助,我们将不胜感激。

我这里有一个链接,非常有助于分页和可排序表链接,这可能会有所帮助。

http://forum.codeigniter.com/thread-1198.html

$config['base_url'] = site_url($this->uri->segment(1) . '/');更改为,

$config['base_url'] = base_url().'movies/index'; 

$config['base_url'] = base_url().'actors/index';

$config['uri_segment'] = 3;