close
https://stackoverflow.com/questions/13530465/how-to-declare-a-global-variable-in-php
直接宣告 $GLOBALS['xxx'],就可以直接在function裏頭使用了。
--
The $GLOBALS
array can be used instead:
$GLOBALS['a'] = 'localhost';
function body(){
echo $GLOBALS['a'];
}
From the Manual:
An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.
--
全站熱搜
留言列表