2011-04-18 90 views
15

我有Ubuntu 10.10与apache2,php 5.3.3-1和mysql 5.1。

我将一些值传递给url中的页面。在该页上,如果我做print_r($ _GET)我看到数组内容,但如果我做print_r($ _REQUEST)数组是空的。这可能是任何想法?

谢谢。

+0

这是一个老问题......你尝试过'var_dump($ GLOBALS ['_REQUEST']);'? – Wh1T3h4Ck5 2011-04-18 10:38:50

+1

yes $ GLOBALS ['_REQUEST']也是空的 – Hawkseye 2011-04-18 10:48:02

+0

在** php.ini **中查看'register_long_arrays'和'auto_globals_jit'。有时它可以工作,当你关闭它们时(更改php.ini后重新启动服务器)。你有什么价值?再看看@ PaulP的答案。 – Wh1T3h4Ck5 2011-04-18 10:52:39

回答

11

也可尝试检查"request_order"选项在php.ini:

; This directive determines which super global data (G,P,C,E & S) should 
; be registered into the super global array REQUEST. If so, it also determines 
; the order in which that data is registered. The values for this directive are 
; specified in the same manner as the variables_order directive, EXCEPT one. 
; Leaving this value empty will cause PHP to use the value set in the 
; variables_order directive. It does not mean it will leave the super globals 
; array REQUEST empty. 
; Default Value: None 
; Development Value: "GP" 
; Production Value: "GP" 
; http://php.net/request-order 
request_order = "GP" 
+0

添加到PHP手册页的链接。你打败了我,所以我删除了我的答案! :) – Treffynnon 2011-04-18 10:44:32

+1

感谢问题已解决。在php.ini中的值是空的,但有趣的是,我在我的服务器上有相同的设置,但它在那里工作。 request_order没有值和variables_order \t EGPCS。再次感谢艰难。 – Hawkseye 2011-04-18 10:59:30

+1

嗨PaulP,我有与Hawkseye相同的问题,但我在我的php.ini文件中发现request_order已设置为“GP”,并且变量_order也设置为“GPCS”。我没有做任何改变。我重新启动了PHP服务器,但仍然无法工作。我使用nginx 1.4.4和PHP 5.5.8 for windows。谢谢。 – 2014-02-07 04:26:10

1

如果您的文章身体比post_max_size要大或upload_max_filesize的其在php.ini可能导致$ _ POST和$ _REQUEST空了。

+0

这不提供问题的答案。一旦你有足够的[声誉](https://stackoverflow.com/help/whats-reputation),你将可以[对任何帖子发表评论](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提问者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-c​​an- I-DO-代替)。 - [来自评论](/ review/low-quality-posts/17410125) – 2017-09-22 04:13:43