Drupal 中 $_REQUEST['page'] 的含义是什么?
$_REQUEST['page']
和这一行的含义是什么?
$total = $GLOBALS['pager_total_items'][0];
Drupal 6 中
What is the meaning of $_REQUEST['page']
, and this line
$total = $GLOBALS['pager_total_items'][0];
in Drupal 6?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Phil 给出的内容是针对正常的 php.ini 的。
然而,在 Drupal 的上下文中,它们具有不同的含义。
在 Drupal 中,如果您尝试使用分页器创建列表,则将
$_REQUEST['page']
设置为表示它是分页器显示,并且该值表示您当前所在的页码。观看。因此,如果您假设每个页面中有 10 个项目,则可以使用类似的方法
来获取页面中第一个项目的编号。
我认为
$_GLOBALS['pager_total_items'][0]
可以用来代替 10(即页面中的项目数),但是我不确定$_GLOBALS[' pager_total_items'][0]
,但我确定第一个。What Phil has given is with respect to the normal php.
In the context of Drupal however they have a different meaning.
In Drupal if you are trying to create a listing with the pager, the
$_REQUEST['page']
is set to signify that it is a pager display, and the value signifies the current page number you are viewing.So if you assume that there are 10 items in a every page, you can use something like
to get the number of the first item in the page.
And I think
$_GLOBALS['pager_total_items'][0]
can be used in place of 10(that is number of items in a page) However I am not sure about$_GLOBALS['pager_total_items'][0]
, but I am sure about the first one.$_REQUEST['page']
检索$_GET
、$_POST
或中任何一个中“page”项的值$_COOKIE
超级全局数组,以先提供命中者为准(在 PHP 5.3 中,顺序取决于request_order
指令)。$_GLOBALS['pager_total_items'][0]
正在引用一个$pager_total_items
潜在的全局变量$pager_total_items
,它看起来是一个数组。[0]
指的是第一项(如果是字符串,则指第一个字符)。据推测,这些变量是在其他地方设置/填充的。我无法提供与 drupal 上下文相关的任何内容。
$_REQUEST['page']
retrieves the value of the "page" item in any of the$_GET
,$_POST
or$_COOKIE
super global arrays, whichever provides a hit first (in PHP 5.3, order depends on therequest_order
directive).$_GLOBALS['pager_total_items'][0]
is referencing a potential global variable$pager_total_items
that appears to be an array. The[0]
is referring to the first item (or first character if it's a string).Presumably, these variables are set / populated elsewhere. I can't provide anything relating to the drupal context.