我有Ubuntu 10.10與apache2,php 5.3.3-1和mysql 5.1。
我將一些值傳遞給url中的頁面。在該頁上,如果我做print_r($ _GET)我看到數組內容,但如果我做print_r($ _REQUEST)數組是空的。這可能是任何想法?
謝謝。
我有Ubuntu 10.10與apache2,php 5.3.3-1和mysql 5.1。
我將一些值傳遞給url中的頁面。在該頁上,如果我做print_r($ _GET)我看到數組內容,但如果我做print_r($ _REQUEST)數組是空的。這可能是任何想法?
謝謝。
也可嘗試檢查"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"
添加到PHP手冊頁的鏈接。你打敗了我,所以我刪除了我的答案! :) – Treffynnon 2011-04-18 10:44:32
感謝問題已解決。在php.ini中的值是空的,但有趣的是,我在我的服務器上有相同的設置,但它在那裏工作。 request_order沒有值和variables_order \t EGPCS。再次感謝艱難。 – Hawkseye 2011-04-18 10:59:30
嗨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
如果您的文章身體比post_max_size要大或upload_max_filesize的其在php.ini可能導致$ _ POST和$ _REQUEST空了。
這不提供問題的答案。一旦你有足夠的[聲譽](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-can- I-DO-代替)。 - [來自評論](/ review/low-quality-posts/17410125) – 2017-09-22 04:13:43
這是一個老問題......你嘗試過'var_dump($ GLOBALS ['_REQUEST']);'? – Wh1T3h4Ck5 2011-04-18 10:38:50
yes $ GLOBALS ['_REQUEST']也是空的 – Hawkseye 2011-04-18 10:48:02
在** php.ini **中查看'register_long_arrays'和'auto_globals_jit'。有時它可以工作,當你關閉它們時(更改php.ini後重新啓動服務器)。你有什麼價值?再看看@ PaulP的答案。 – Wh1T3h4Ck5 2011-04-18 10:52:39