Accessing variables and methods outside of class definitions

后端 未结 6 1684
盖世英雄少女心
盖世英雄少女心 2020-12-05 11:02

Suppose I have a php file along these lines:


Is there anything sp

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 11:25

    Try to create a new class that call $foo and set a variable like

    class SomeClass {  
     public function tada(){
         $foo = new Class;
         $foo = $foo->getFoo;
     }
    }
    

提交回复
热议问题