code
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);