gpt4 book ai didi

php - 在 PHP 5.3 中重新引入 $HTTP_POST_VARS

转载 作者:行者123 更新时间:2023-12-03 00:53:55 25 4
gpt4 key购买 nike

我需要运行 legacy PHP application在共享托管环境中。我向我的客户 promise ,我会在一段时间内支持该遗留应用程序,但我发现它不起作用,因为它广泛使用已弃用的 $HTTP_POST_VARS

降级 PHP 不是一个选项。修补应用程序可能是不可行的,因为 PHP 文件是从 Windows 可执行文件生成的(我不是在开玩笑!),并且每次从桌面重新生成站点时,我们都可能会丢失修改。

我问是否有一种方法可以告诉 PHP 为主机上的所有网站或仅针对特定虚拟主机重新引入 $HTTP_POST_VARS 。任何其他选项/建议表示赞赏

最佳答案

你可以这样做

配置.php

$HTTP_POST_VARS = &$_POST;
$HTTP_GET_VARS = &$_GET;
$HTTP_COOKIE_VARS = &$_COOKIE;

.htaccess

php_value auto_prepend_file /path/to/config.php

PHP 文档 auto_prepend_file string

Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the require function, so include_path is used.

The special value none disables auto-prepending.

编辑:为了更加彻底,这些是也可以使用别名的其他超全局变量:

$HTTP_SERVER_VARS = &$_SERVER;
$HTTP_POST_FILES = &$_FILES;
$HTTP_SESSION_VARS = &$_SESSION;
$HTTP_ENV_VARS = &$_ENV;

关于php - 在 PHP 5.3 中重新引入 $HTTP_POST_VARS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12978293/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com