<?php namespace Core; /** * 单利模式 * Class Database * @package Core */ class Database{ /** * 单例模式 * @var */ protected static $db = null; /** * 私有化 */ private function __construct(){ } /** * 私有化 */ private function __clone(){ } /** * 私有化 * 当在类外部使用unserialize()时会调用这里的__wakeup()方法 */ private function __wakeup(){ } /** * 获取实例 */ static function getInstance(){ if(is_null(self::$db)){ self::$db = new self(); } return self::$db; } /** * @param $where * @return $this */ public function where($where){ return $this; } /** * @param $order * @return $this */ public function order($order){ return $this; } /** * @param $limit * @return $this */ public function limit($limit){ return $this; } }