<?php
namespace Imooc;
class Factory
{
public static function createFactory($class)
{
$db = new $class;
return $db;
}
}
namespace Imooc;
class Factory
{
public static function createFactory($class)
{
$db = new $class;
return $db;
}
}
2016-05-14
private static $db;
private function __construct()
{
}
static function getInstance()
{
if(!(self::$db instanceof self)){
self::$db = new self();
}
return self::$db;
}
前面那里 错了一部分 开始没运行,没发现.
private function __construct()
{
}
static function getInstance()
{
if(!(self::$db instanceof self)){
self::$db = new self();
}
return self::$db;
}
前面那里 错了一部分 开始没运行,没发现.
2016-05-11
class DataBase{
private static $db;
private function __construct()
{ }
static function getInstance()
{
if(!self::$db instance of self){
self::$db = new self();
}
return self::$db;
}
protected function __clone(){
}
}
private static $db;
private function __construct()
{ }
static function getInstance()
{
if(!self::$db instance of self){
self::$db = new self();
}
return self::$db;
}
protected function __clone(){
}
}
2016-05-11