我試着通過分頁DB返回的結果。但是,當我嘗試從URI偏移:Pagnation用GET數據在URI - 笨
questions/search?content=foobar/4
/4
應該補償,但被分配到$_GET
值。
這是在控制器的整個方法:
$results = $this->question->search_results_count($content);
$this->load->library('pagination');
$config['total_rows'] = count($results);
$offset = $this->uri->segment(3);
if ($offset == false) $offset = 0;
$config['full_tag_open'] = '<ul class="pages">';
$config['full_tag_close'] = '</ul>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li><a class="active">';
$config['cur_tag_close'] = '</a></li>';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '<li>';
$config['next_tag_open'] = '<li class="next">';
$config['next_tag_close'] = '</li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['first_link'] = '<<';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['last_link'] = '>>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['per_page'] = 1;
$config['uri_segment'] = 2;
$config['page_query_string'] = TRUE;
$config['use_page_numbers'] = TRUE;
$config['suffix'] = '?content='.$content;
$config['base_url'] = base_url().'questions/search/';
$this->pagination->initialize($config);
查詢字符串必須在你的URL的最後一件事。類似於/ search/4?content = foo的作品? –
如何在配置中查看base_url? –
看着你的config/config.php文件和條目,上面寫着$配置['BASE_URL] = XXXXXX; –