$GLOBALS

$GLOBALS — ����ȫ���������п��õ�ȫ������

˵��

һ��������ȫ��������ȫ��������������������־�������ļ���

����

Example #1 $GLOBALS ����

<?php
function test() {
    
$foo = "local variable";

    echo 
'$foo in global scope: ' . $GLOBALS["foo"] . "\n";
    echo 
'$foo in current scope: ' . $foo . "\n";
}

$foo = "Example content";
test();
?>

�������̵���������ڣ�

$foo in global scope: Example content
$foo in current scope: local variable

ע��

Note:

"Superglobal"Ҳ��Ϊ�Զ�����ȫ�ֱ�������ͱ�ʾ���ڽű��������������ж��ǿ��õġ�����Ҫ�ں����򷽷����� global $variable; ����������

Note: ����������

������������ȫ�ֱ�����ͬ��$GLOBALS��PHP�����ǿ��õġ�