connect(); } public static function getInstance() { if (!isset(self::$instance)) { $instance = new self(); self::$instance = $instance; } else { $instance = self::$instance; } return $instance; } public function select($table,$where=[],$column='*',$limit=10,$offset=0,$order=null){ if ($limit){ $where['LIMIT']=[$offset,$limit]; } if ($order){ $where['ORDER']=$order; } //'t_article', "*",['LIMIT'=>[4,2],'ORDER'=>'articleno'] return $this->postgres->select($table,$column,$where); } public function connect() { $confg = Core::getData(); $this->postgres = new medoo([ // 必须配置项 'database_type' => 'pgsql', 'database_name' => $confg['dbname'], 'server' => $confg['host'], 'username' => $confg['username'], 'password' => $confg['password'], 'charset' => 'utf8', // 可选参数 'port' => $confg['port'], // 连接参数扩展, 更多参考 http://www.php.net/manual/en/pdo.setattribute.php 'option' => [ \PDO::ATTR_CASE => \PDO::CASE_NATURAL ] ]); } }