<?php header("Content-type:text/html;charset=utf-8"); /** * 共同接口 */ interface db { function conn(); } /** * mysql类 */ class DbMysql implements db { public function conn() { echo "连接上了mysql"; } } /** * sqlite类 */ class DbSqlite implements db { public function conn() { echo" Connection on SQLite " ; } } $ DB = new new DbMysql (); $ DB -> Conn (); $ DB = new new DbSqlite (); $ DB -> Conn ();
Design Patterns php example code for interface development
Guess you like
Origin www.cnblogs.com/Mishell/p/12181011.html
Recommended
Ranking