用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3358|回复: 11
收起左侧

[讨论/交流] 新手求助啊 ci的分页 来看看吧

[复制链接]
发表于 2012-8-20 15:43:55 | 显示全部楼层 |阅读模式
$config['per_page'] = 1;
  $config['base_url'] = 'http://localhost/index.php/index_c/index/';
  
  $config['total_rows'] = $this->db->count_all('pc');
  $config['uri_segment'] = 3;
  
  $arr = $this->index_m->fenye($config['per_page'],$this->uri->segment(3));
  
  $this->pagination->initialize($config);
  
  foreach($arr as $data_item){
   print_r($data_item)."<br />";
  }
  
  
  echo $this->pagination->create_links();

这是控制器代码;还有在这个页面显示分页   分页类已经载入了,能显示分页  没有报错   但是点击分页的那个123  或者是最后一页什么的  都没反应  这是怎么回事啊  搞半天了
发表于 2012-8-20 15:54:31 | 显示全部楼层
这个问题一般是base_url那里出问题了,你再好好检查一下
 楼主| 发表于 2012-8-20 15:57:20 | 显示全部楼层
我试过了啊,试好长时间啦,我的控制器在index.php/index_c/index方法啊   
 楼主| 发表于 2012-8-20 15:58:59 | 显示全部楼层
http://localhost/index.php/index_c/index/&per_page=1         为什么 点击 123 这个分页连接   url是这个样子的
 楼主| 发表于 2012-8-20 15:59:47 | 显示全部楼层
而且  点击分页  后面的那个per_page=1  会动的  就是内容不换   咋回事啊
 楼主| 发表于 2012-8-20 16:15:31 | 显示全部楼层
 楼主| 发表于 2012-8-20 16:22:39 | 显示全部楼层
 楼主| 发表于 2012-8-20 16:43:08 | 显示全部楼层
哦  我研究出来了,那个地址http://localhost/index.php/index_c/index/&per_page=1的
怎么变成http://localhost/index.php/index_c/index/1 这样的   我手动加上去  就能用了   哪里需要改一下啊   没人回答吗?|
 楼主| 发表于 2012-8-20 17:13:12 | 显示全部楼层
 楼主| 发表于 2012-8-20 17:39:48 | 显示全部楼层

本版积分规则