$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
 

$GLOBAL["变量名"];

posted on 2014-07-07 02:14  13m0n  阅读(148)  评论(0编辑  收藏  举报