如何更改Paginator的页面名称? [英] How do you change the page name for Paginator?
问题描述
当前Paginator
正在使用?page=N
,但是我想使用其他东西.我该如何更改,以改为?sida=N
?
Current Paginator
is using ?page=N
, but I want to use something else. How can I change so it's ?sida=N
instead?
我已经看过Illuminate\Pagination\Environment
,并且有一种方法(setPageName()
)可以对其进行更改(我认为),但是如何使用它?
I've looked at Illuminate\Pagination\Environment
and there is a method (setPageName()
) there to change it (I assume), but how do you use it?
在Paginator
类中,有一种方法可以更改Environment
类中的基本url(setBaseUrl()
),但是没有用于设置页面名称的方法.我真的需要扩展Paginator
类仅仅是为了能够更改页面名称吗?
In the Paginator
class there is a method the change the base url (setBaseUrl()
) in the Environment
class, but there is no method for setting a page name. Do I really need to extend the Paginator
class just to be able to change the page name?
推荐答案
就像您说的那样,您可以使用setPageName
方法:
Just like you said you can use the setPageName
method:
Paginator::setPageName('sida');
您可以将其放置在app/start/global.php
中.
这篇关于如何更改Paginator的页面名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!