PHP: Calling another class' method

后端 未结 4 1993
别跟我提以往
别跟我提以往 2020-12-23 09:50

I\'m still learning OOP so this might not even be possible (although I would be surprised if so), I need some help calling another classes method.

For example in

4条回答
  •  盖世英雄少女心
    2020-12-23 10:35

    //file1.php
    name;
       }   
    }
    ?>
    
    //file2.php
    getName();
           echo $name;    //Prints John
         }
       }
    
       $classb = new ClassB();
       $classb->callA();
    ?>
    

提交回复
热议问题