$ _REQEST ​​['ID']中的值为空,但它存在于$ _POST ['ID']中

时间:2015-05-20 04:49:00

标签: php

当我尝试使用POST打印表单值时,它可以正常工作

var_dump($_POST); // Value  is there

在下一行中,我尝试转储$ _REQUEST它是空的。

var_dump($_REQUEST) // Empty 

我不知道为什么会这样发生。

1 个答案:

答案 0 :(得分:0)

检查php.ini中的http://php.net/manual/en/ini.core.php#ini.request-order设置,不应为空,可能设置为" GC"如果你想按顺序进行GET和POST。

在我的php.ini中(你可以从终端运行php --ini来找到你的php.ini所在的位置):

; This directive determines which super global arrays are registered when PHP
; starts up. If the register_globals directive is enabled, it also determines
; what order variables are populated into the global space. G,P,C,E & S are
; abbreviations for the following respective super globals: GET, POST, COOKIE,
; ENV and SERVER. There is a performance penalty paid for the registration of
; these arrays and because ENV is not as commonly used as the others, ENV is
; is not recommended on productions servers. You can still get access to
; the environment variables through getenv() should you need to.
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS";
; http://php.net/variables-order
variables_order = "GPCS"