Home  >  Article  >  Backend Development  >  How to access member functions of another class in PHP

How to access member functions of another class in PHP

巴扎黑
巴扎黑Original
2016-11-24 11:23:491575browse

Write a static method in the category to return the $ A instance, call


Class Instance {
Private Static $ A; $a=new a(); }

class b{
function itb(){
  // Obtain the single instance of a here, and there will be no multiple instantiations
  $a=instance::getA();  
  $a->ita();
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:android gets json dataNext article:android gets json data