0

Paginator 正在为第二个页面加载 404 页面。猜测问题出在此控制器中存在的 _remap 方法中。

我的分页器:

   $this->config->load('pagination', TRUE);
    $config = array_merge($this->config->item('pagination'), Array(
        'base_url'   => site_url() . "/welcome",
        'total_rows'  => count($commentsOfInterview),
        'per_page'   => 2,
        'uri_segment'  => 2,
    ));
    $this->pagination->initialize($config);

    $page = ($this->uri->segment(1)) ? $this->uri->segment(1) : 1;
    $commentsList['comments'] = $this->em->getRepository('Entities\Comment')->findPageOfActive($page, $config["per_page"], 'DESC', $lastInterviewId);
    $commentsList['links'] = $this->pagination->create_links();

Paginator 正在加载,但对于来自 2 的页面,它会加载 404 页面。我怎样才能解决这个问题而不删除_remap?

4

1 回答 1

0
    public function _remap($method) {
        if(method_exists($this, $method)){
            if( $this->em->getRepository('Entities\User')->getUserId() === null && $this->em->getRepository('Entities\User')->getUserRole() !== 'VISITOR'){
                $this->em->getRepository('Entities\User')->setUserRole('VISITOR');
                $options=array(
                    'client_id' => 'interview',
                    'client_secret' => 'interview',

                );
                $params=array(
                    'scope'=>'email',
                    'cur_uri' => 'http://192.168.0.129/index.php/' . $this->uri->uri_string(),
                    'redirect_uri' => 'http://192.168.0.129/index.php/UserController/authorise/muloqot',  //?connect=muloqot',

                );
                $client = new Oauth2_MuloqotClientAPI($options);
                $client->isAuthorized($params);
            }
/*            else if($this->em->getRepository('Entities\User')->getUserRole() === 'VISITOR'){
                $this->em->getRepository('Entities\User')->deleteSessionData();
            }*/
            if ($this->uri->segment(3)) {
                return $this->$method($this->uri->segment(3));
            } else return $this->$method();
        } else {
            $error404 = site_url($this->router->routes['404_override']);
            redirect($error404);
        }
    }
于 2013-04-03T12:39:17.710 回答