php-7 - 我升级到 php 7,超全局请求为空

标签 php-7 superglobals

我从 PHP 5.6 更新到 PHP 7。

我做的每个 $_REQUEST['some_var'] 都会返回一个未设置的错误...

$_REQUEST 为空是否正常?

示例:

echo $_REQUEST['login_ID']

返回

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-7 - 我升级到 php 7,超全局请求为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36500584/

相关文章:

matlab - 在 Matlab 中定义全局常量

带有模式的 Php 格式字符串

ubuntu 14.04 上 php 7 的 xdebug

visual-studio-code - 未找到 PHP 可执行文件。安装 PHP 7 并将其添加到您的 PATH 或设置 php.executablePath 设置

php - 如果给 $_REQUEST 赋值会发生什么?

php - 阻止 PHP 在 $_POST 超全局中创建数组

ubuntu-14.04 - 如何在 Ubuntu 上更改 PHP 版本

Docker、Alpine、IonCube、PHP7 FPM

php - 为什么 PHP 需要递归存储相同的全局数据?

php - 检查 $_COOKIE 值是否为空