在PHP 5.3中重新引入$ HTTP_POST_VARS [英] Reintroduce $HTTP_POST_VARS in PHP 5.3

查看:77
本文介绍了在PHP 5.3中重新引入$ HTTP_POST_VARS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在共享托管环境中运行 旧版 PHP应用程序.我已经向客户保证我会在一段时间内支持该旧版应用程序,但是我发现它不起作用,因为它广泛使用了已弃用的$HTTP_POST_VARS.

I need to run a legacy PHP application in a shared hosting environment. I have promised my customer I'll support that legacy application for some time but I found that it doesn't work because it widely uses the deprecated $HTTP_POST_VARS.

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

Downgrading PHP is not an option. Patching the application could be infeasible because the PHP files are generated from a Windows executable file (I'm not kidding!) and every time the site is regenerated from desktop we could lose modifications.

我在问是否有一种方法可以告诉PHP重新为主机上的所有网站或特定虚拟主机重新引入$HTTP_POST_VARS.任何其他选择/建议都将受到赞赏

I'm asking if there is a way to tell PHP to reintroduce $HTTP_POST_VARS for all websites on a host or just for a particular vhost. Any other option/suggestion is appreciated

推荐答案

您可以做到

config.php

config.php

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

.htaccess

.htaccess

php_value auto_prepend_file /path/to/config.php

PHP文档 auto_prepend_file字符串

指定在主文件之前自动解析的文件的名称.包含该文件的方式与使用require函数调用时一样,因此将使用include_path.

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.

特殊值none会禁用自动添加.

The special value none disables auto-prepending.

要更加透彻,这些是其他也可以使用别名的超全局变量:

To be extra thorough, these are the other superglobals that could also be aliased:

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

这篇关于在PHP 5.3中重新引入$ HTTP_POST_VARS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆