没有发现我有问题使CodeIgniter的分页当我点击链接打开我得到的404页没有发现 我在CONTROLER代码CodeIgnier 404错误页面分页
class Records extends CI_Controller
{
public function index()
{
$this->load->library('pagination');
$config['base_url']= 'localhost/records';
$config['total_rows']= $this->db->get('pages')->num_rows;
$config['per_page']= 2;
$config['num_links']= 5;
$this->pagination->initialize($config);
$data['query'] = $this->db->get('pages',$config['per_page'],$this->uri->segment(2));
$this->load->view('view_header');
$this->load->view('includes/nav_home');
$this->load->view('view_list', $data);
$this->load->view('view_footer');
}
我想指出错误的URI细分,但仍然没有结果。 ?我以正确的方式编写代码。我的base_url在配置文件中是空的?
鉴于我的代码是
<?php
echo $this->session->flashdata('item');
echo '<h4>Lista podataka</h4>';
foreach ($query->result() as $q):
?>
<a href="/z/update/grab/<?php echo $q->id;?>/<?php echo $q->info; ?>"><?php echo $q->info . br() . br()?></a>
<?php
endforeach;
echo $this->pagination->create_links();
?>
请其非常重要的
它的问题,因为我把分页索引()函数,我创建单独的功能,它的工作原理! – 2014-09-11 08:54:13
你应该把正确的base_url,尝试改变你的代码,并告诉我,如果你仍然有错误 – CodeSlayer 2014-09-11 08:58:39
我做了这个和它的工作功能页面() {this-> load-> library(s) '分页'); $ config ['base_url'] ='http:// localhost/z/records/page'; $ config ['total_rows'] = $ this-> db-> get('pages') - > num_rows; $ config ['per_page'] = 2; $ config ['num_links'] = 5; $ this-> pagination-> initialize($ config); $ this-> load-> model('Data'); ($ 3)); $ data ['query'] = $ this-> Data-> data_pagination($ config ['per_page'],$ this-> uri-> segment(3)); } – 2014-09-11 09:33:39