You can emulate register_globals
by using extract in global scope:
extract($_REQUEST);
Or put it to independent function using global and variable variables
function globaling()
{
foreach ($_REQUEST as $key => $val)
{
global ${$key};
${$key} = $val;
}
}
If you have a released application and do not want to change anything in it, you can create globals.php
file with
<?php
extract($_REQUEST);
then add auto_prepend_file directive to .htaccess (or in php.ini)
php_value auto_prepend_file ./globals.php
After this the code will be run on every call, and the application will work as though the old setting was in effect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…