问个$GLOBALS的问题
下面代码中$GLOBALS代表的是什么?为什么要$GLOBALS[$key]这样写?<?php
/**
* @return void
* @param array $vars
* @desc For use by unregister_globals()
*/
function unregister_globals_support(&$vars)
{
foreach (array_keys($vars) as $key)
{
if (isset($GLOBALS[$key])) unset($GLOBALS[$key]);
}
}
/**
* @return void
* @desc unregister globals registered by register_globals
*/
function unregister_globals()
{
if (ini_get('register_globals'))
{
$variables_order = ini_get('variables_order');
for ($i=0; $i<strlen($variables_order); $i++)
{
switch (strtoupper($variables_order{$i}))
{
case 'E': unregister_globals_support($_ENV); break;
case 'G': unregister_globals_support($_GET); break;
case 'P': unregister_globals_support($_POST); break;
case 'C': unregister_globals_support($_COOKIE); break;
case 'S': unregister_globals_support($_SERVER); break;
}
}
}
}