我升级到php7,超全局请求为空
I upgraded to php 7 and the superglobal request is empty
我从 PHP 5.6 更新到 PHP 7.
每 $_REQUEST['some_var']
我都会 returns 一个未设置的错误...
$_REQUEST
为空是否正常?
示例:
echo $_REQUEST['login_ID']
returns
Notice: Undefined index: login_ID in
检查 php.ini
文件中的 request_order
。可能是设置不正确。
http://php.net/manual/en/ini.core.php#ini.request-order
; 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 5.6 更新到 PHP 7.
每 $_REQUEST['some_var']
我都会 returns 一个未设置的错误...
$_REQUEST
为空是否正常?
示例:
echo $_REQUEST['login_ID']
returns
Notice: Undefined index: login_ID in
检查 php.ini
文件中的 request_order
。可能是设置不正确。
http://php.net/manual/en/ini.core.php#ini.request-order
; 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"