我有这个很长的网址
website.local/movies/movies/12?filter=views
(分页+获取参数)
我如何获取此网址(删除“电影”)
http://localhost/downloadz/movies/12?filter=views
我的控制器
public function movies(){
$data = array();
// Système de filtrage
//$config['page_query_string'] = TRUE;
//$config['query_string_segment'] = 'page';
//$config['first_url'] = $config['base_url'].'?'.http_build_query($_GET);
$get_vars = $this->input->get();
if(is_array($get_vars)){
$config[‘suffix’] = '?'.http_build_query($get_vars,'', '&');
}
echo $this->input->get('filter');
$config['base_url'] = base_url('films/movies').
$config['total_rows'] = $this->db->where('type','movie')->get('sheets')->num_rows();
$config['per_page'] = 12;
$config['num_links'] = 8;
$config['full_tag_open'] = '<div class="pagination"><ul>';
$config['full_tag_close'] = '</ul></div><!--pagination-->';
$config['first_link'] = '« First';
$config['first_tag_open'] = '<li class="prev page">';
$config['first_tag_close'] = '</li>';
$config['last_link'] = 'Last »';
$config['last_tag_open'] = '<li class="next page">';
$config['last_tag_close'] = '</li>';
$config['next_link'] = 'Suivant →';
$config['next_tag_open'] = '<li class="next page">';
$config['next_tag_close'] = '</li>';
$config['prev_link'] = '← Précédent';
$config['prev_tag_open'] = '<li class="prev page">';
$config['prev_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li class="page">';
$config['num_tag_close'] = '</li>';
$this->pagination->initialize($config);
//$this->input->get('filter', TRUE)
$data['items'] = $this->db->where('type','movie')->order_by($this->input->get('filter',TRUE), "DESC")->get('sheets',$config['per_page'],$this->uri->segment(3))->result();
$this->load->view('public/general/movies',$data);
}
答案 0 :(得分:1)
请考虑您的网址:
http://localhost/movie/movies/12?filter=views
使用路由(config / routes.php):
$route['mov'] = "movie/movies"
现在您的网址将是:
http://localhost/mov/12?filter=views