时间:2021-07-01 10:21:17 帮助过:32人阅读
createDB();$db->conn();echo '
';//连接Sqlite$fact = new SqliteFactory();$db = $fact->createDB();$db->conn();echo '
';/** * 扩展:添加Oracle连接 */class OracleDB implements Db{ function conn() { echo '连接上Oracle....'; }}class OracleFactory implements Factory{ public function createDB() { return new OracleDB(); }}//连接Oracle$fact = new OracleFactory();$db = $fact->createDB();$db->conn();echo '
';