class mysqli2 implements mysql{
public function connect(){
echo 'mysqli';
}
}
class pdo2 implements mysql{
public function connect(){
echo 'pdo';
}
}
class mysqlFactory{
static public function factory($class_name){
return new $class_name();
}
}
$obj = mysqlFactory::factory('pdo2');
$obj->connect();
3、注册模式