codeigniter分页第一页网址

fl3*_*3x7 2 php pagination uri codeigniter codeigniter-2

我知道他们是关于codeigniter分页的一些问题,但从我可以说它们似乎并不相关.

仅供参考我在我的网址中使用页码,而不是索引(使用配置选项use_page_numbers)

所以我的问题是第一个链接.

我在第1页以外的页面的网址结构是:

http://www.something.com/foo/page/x

一切正常但是当我将鼠标悬停在第1页的链接上时,出现的网址是:

http://www.something.com/foo/page/

现在我知道那是因为我已经将基本网址声明为:

$config['base_url'] = $this->uri->slash_segment(1, 'both') . 'page/';
Run Code Online (Sandbox Code Playgroud)

但是,将第1页的URl作为:

http://www.something.com/foo/

要么

http://www.something.com/foo/page/1/

希望这是有道理的,有人可以提供帮助.我确实尝试将base_url设置为page/1,如果第3段是空的但没有欢乐.

谢谢阅读

Afs*_*hin 8

想象一下你的base_url是:

$config['base_url'] = base_url() . 'method/page/';
Run Code Online (Sandbox Code Playgroud)

因此,更改下面的代码,以获得您想要的第一个URL:

$config['base_url'] = base_url() . 'method/page/';
$config['first_url'] = '1';
$this->pagination->initialize($config);
Run Code Online (Sandbox Code Playgroud)

现在第一页链接应该是:

http://example.com/method/page/1