Rookie solution A: How do you define an array of file scopes in PHP?
Global $param _array = Array (' P ', ' Q ', ' CR ', ' LT ', ' Tc,m1 ', ' tc,m2 ', ' Ri,m1 ', ' ri,m2 ');
Displays syntax errors, so how do you get this array to have a scope within the file?
Or is the file scope of an array impossible to implement?
------to solve the idea----------------------
No special definition is necessary
One but define an array
$a =array (1,2,3,4,5)
Then its scope is in this file, all functions can be accessed.
------to solve the idea----------------------
Defined in a.php, then this array defaults to global variables, functions can be used directly outside the function, the function of domestic claims global $a, to use.
------to solve the idea----------------------
$num = 123;
function aa () {
Global $num;
Echo $num;
}
AA ();
?>
------to solve the idea----------------------
$param _array = Array (' P ', ' Q ', ' CR ', ' LT ', ' Tc,m1 ', ' tc,m2 ', ' Ri,m1 ', ' ri,m2 ');
function local () {
Global $param _array;
Print_r ($param _array);
}
Class localclass{
function Run () {
Global $param _array;
Print_r ($param _array);
}
}
Print_r ($param _array);
Local ();
$obj = new Localclass ();
$obj->run ();