...
|
...
|
@@ -42,10 +42,22 @@ class Db { |
|
|
return $this->client;
|
|
|
}
|
|
|
|
|
|
private $host='';
|
|
|
private $prot=3306;
|
|
|
private $user='';
|
|
|
private $pwd='';
|
|
|
private $database='';
|
|
|
|
|
|
public function __construct()
|
|
|
|
|
|
public function __construct($host='',$database='',$user='',$pwd='',$prot=3306)
|
|
|
{
|
|
|
|
|
|
$this->host = $host ? $host : DB_HOST;
|
|
|
$this->prot = $prot ? $prot : DB_PORT;
|
|
|
$this->user = $user ? $user : DB_USER;
|
|
|
$this->pwd = $pwd ? $pwd : DB_PASSWORD;
|
|
|
$this->database = $database ? $database : DB_DATABASE;
|
|
|
|
|
|
// $this->connect();
|
|
|
|
|
|
}
|
...
|
...
|
@@ -62,9 +74,9 @@ class Db { |
|
|
DBPOOLCONNECTFOR:
|
|
|
try {
|
|
|
$this->client = new \PDO(
|
|
|
'mysql:charset=utf8mb4;dbname='.DB_DATABASE.';host='.DB_HOST.';port='.DB_PORT,
|
|
|
DB_USER,
|
|
|
DB_PASSWORD,
|
|
|
'mysql:charset=utf8mb4;dbname='.$this->database.';host='.$this->host.';port='.$this->prot,
|
|
|
$this->user,
|
|
|
$this->pwd,
|
|
|
[
|
|
|
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
|
|
|
\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'",
|
...
|
...
|
|