The concept is still unclear, use do not understand, stupid person!!!
I want to write a whole station global variable, in which class can be shared
For example, I initialize the global variable in Class A, then I can read and write in other classes to share the variable, ask which boss write an example, grateful!!!
Reply to discussion (solution)
Use Session or Cookie
Then you just write a base class, declare a variable ...
Then you just write a base class, declare a variable ...
For example, thank you!!!
Use the global reference in the method of the class
Like what
$a = "123"; class dd{ function Show () { global $a; $a = "CC"; }} Class cc{ function Show () { global $a; return $a; }} $d = new DD (), $d-and show (), $c = new CC (), Echo $c-show ();
You can see that the result of the final output is CC
Initname ("Phper");//Instantiate class two $b = new Son2class ();//Get $name value $name = $b->index ();//Initialize a Son1class value in $name, can also be called in Son2class. Echo $name; Output Phper