![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
class
a{
public function __construct(){
echo " 你使用了A类 " ;
}
}
class b{
public function __construct(){
echo " 你使用了B类 " ;
}
}
class createCls{
private $obj ;
public function __construct( $clsName ){
$this -> obj = new $clsName ();
}
}
$a = new createCls(a);
$b = new createCls(b);
public function __construct(){
echo " 你使用了A类 " ;
}
}
class b{
public function __construct(){
echo " 你使用了B类 " ;
}
}
class createCls{
private $obj ;
public function __construct( $clsName ){
$this -> obj = new $clsName ();
}
}
$a = new createCls(a);
$b = new createCls(b);