Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 代码点火器页码是否正确显示?_Php_Codeigniter_Pagination - Fatal编程技术网

Php 代码点火器页码是否正确显示?

Php 代码点火器页码是否正确显示?,php,codeigniter,pagination,Php,Codeigniter,Pagination,我使用了codeigniter的分页…但主要问题是页码显示不正确 在控制器中,我使用了以下代码: $count = $this->db->count_all_results('table'); $this->load->library('pagination'); $this->load->library('pagination'); $config['base_url'] = base_url().'/lists/'; $

我使用了codeigniter的分页…但主要问题是页码显示不正确

在控制器中,我使用了以下代码:

$count = $this->db->count_all_results('table');

    $this->load->library('pagination');

    $this->load->library('pagination');
    $config['base_url'] = base_url().'/lists/';
    $config['total_rows'] = $count;

    $config['per_page'] = 2;
    $config['uri_segment'] = $this->uri->segment('2');
    $config['use_page_numbers'] = TRUE;

    $this->pagination->initialize($config);

    if($config['uri_segment']<=0) $offset = 0;
    else $offset = ($config['uri_segment'] - 1)* 2;
    $limit = 2;
    $data['infoArr'] = $this->home_model->get_all($offset, $limit);

    $this->load->view('list_info',$data);
鉴于我过去

<?php echo $this->pagination->create_links(); ?>

在我的表9中插入了信息。。。 根据数据库,应显示分页1 2 3 4 5,但仅显示1 2 3>Last

当我点击2时,只有4个数字显示,否则4和5个数字不显示。。。 代码中的主要问题是什么。。。。 请帮帮我


提前感谢所有帮助我的人。

是由于以下设置:

$config['per_page'] = 2;
以上设置是用于

var $per_page = 10; // Max number of items you want shown per page 

要么换大一点的数字,要么就让它空白(默认值是10)

我想你可以做一个

$config['num_links'] = 4;

如果您希望显示更多案例。否则,扩展分页库以执行您希望它执行的操作。

初始化此索引,它将工作:

$config['num_links'] = NUM_LINKS;

感谢您的帮助,但“下一步”按钮工作不正常。它适用于第1页和第2页,然后在第3页显示第1页…确保您的
$config['total_rows']
正确,并考虑扩展和更改分页库,如果NeeDe.Dead行正确,页数显示正确,但Next按钮和PrimeButt不正常工作…那么默认分页可能不是您所要的。默认分页几乎只显示功能链接。这使得
上一页
永远不会显示在第一页,而
下一页
永远不会显示在最后一页。如前所述,考虑扩展分页库。
$config['num_links'] = NUM_LINKS;