數據庫類實現單利模式
class?Database{
????static?protected?$db;
????private?function?__construct(){
????????
????}
????static?function?getInstance(){
????????echo?111;
????????if(self::$db){
????????????return?self::$db;
????????}else{
????????????self::$db?=?new?self();
????????????return?self::$db;
????????}
????}
????function?where($where){
????????return?$this;
????}
????function?order($order){
????????return?$this;
????}
????function?limit($limit){
????????return?$this;
????}
}
2016-01-02
是單粒不是單利