富贵资源网 Design By www.hznty.com
核心代码:
/* *pgsql类 */ class pgdb { public $pdo; public static $PDOInstance; public $config; public $data; public $filed = '*'; public $table; public $limit; public $order; public $where; public $left; const LOGIN = 7; const USER = 1; const GROUP = 2; const USERGROUP = 3; const LOG = 6; const WARING = 1; const ERROR = 2; const INFO = 0; public function __construct() { if (!self::$PDOInstance) { $this->config = json_decode(file_get_contents("./config/db.json"), true); $config = $this->config; $host = $config["data_base"]["db_host"]; $dbname = $config["data_base"]["db_name"]; $port = $config["data_base"]["db_port"]; $username = $config["data_base"]["db_user"]; $password = $config["data_base"]["db_pwd"]; if ($config["data_base"]["db_host"] != 'localhost') { $hosturl = "host=$host;"; } try { self::$PDOInstance = new PDO("pgsql:" . $hosturl . "port=$port;" . "dbname=$dbname;" , $username , $password , array( PDO::ATTR_PERSISTENT => true, ) ); } catch (Exception $ex) { header("Content-type: text/html; charset=utf-8"); $error = "数据库初始化失败,已强制断开链接。<br />抓取到的异常栈如下:<br /><pre>" . print_r($ex, true) . "</pre>"; die($error); } try { self::$PDOInstance->query("SET client_encoding='UTF-8';"); self::$PDOInstance->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); self::$PDOInstance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $exc) { $this->pdo=NULL; $doc = <<<DOC <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="/UploadFiles/2021-04-02/jquery-1.11.1.min.js">
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...