在PHP 5.4启用了register_globals [英] Enable register_globals in PHP 5.4
问题描述
我的工作,使用 register_globals的
的框架。我本地的PHP版本是5.4。我知道了register_globals是DE preCATED因为 PHP 5.3.0
并取消在 PHP 5.4
。但是,我必须使它在 PHP 5.4的工作
,有什么办法?任何帮助和建议将高度AP preciable。谢谢你。
I am working on a framework that uses register_globals
. My local php version is 5.4. I know register_globals is DEPRECATED since PHP 5.3.0
and REMOVED in PHP 5.4
. But i have to make it work on PHP 5.4
, Is there any way? Any help and suggestions will be highly appreciable. Thanks.
推荐答案
您可以模拟 register_globals的
使用的提取在全球范围:
You can emulate register_globals
by using extract in global scope:
extract($_REQUEST);
或者使用全局和可变变量把它独立的功能
function globaling()
{
foreach ($_REQUEST as $key => $val)
{
global ${$key};
${$key} = $val;
}
}
P.S。我认为你已经发布的应用程序,并且不希望它改变任何东西。
P.S. i think that your have released application and do not want to change anything in it.
您可以创建 globals.php
文件与
然后添加 AUTO_ prepend_file 指令的.htaccess
Then add auto_prepend_file directive to .htaccess
php_value AUTO_ prepend_file ./globals.php
php_value auto_prepend_file ./globals.php
在这个全局变量将是prePEND到每一个电话
After this globals will be prepend to every call
这篇关于在PHP 5.4启用了register_globals的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!