Fix MySQL連接的Port沒生效
This commit is contained in:
parent
cc02589d2d
commit
e174ef3605
@ -35,13 +35,12 @@ class MySQLDB extends PDO {
|
|||||||
*/
|
*/
|
||||||
public function __construct($dbname, $host, $port, $user, $passwd){
|
public function __construct($dbname, $host, $port, $user, $passwd){
|
||||||
parent::__construct('mysql:dbname='.$dbname
|
parent::__construct('mysql:dbname='.$dbname
|
||||||
.';host:'.$host.';port='.$port
|
.';host='.$host.';port='.$port
|
||||||
.';charset=utf8', DB_USER, DB_PASS);
|
.';charset=utf8', DB_USER, DB_PASS);
|
||||||
|
|
||||||
//配合PHP< 5.3.6 PDO沒有charset用的
|
//配合PHP< 5.3.6 PDO沒有charset用的
|
||||||
//參考: http://gdfan1114.wordpress.com/2013/06/24/php-5-3-6-%E7%89%88-pdo-%E9%85%8D%E5%90%88%E5%AD%98%E5%8F%96%E8%B3%87%E6%96%99%E5%BA%AB%E6%99%82%E7%9A%84%E4%B8%AD%E6%96%87%E5%95%8F%E9%A1%8C/
|
//參考: http://gdfan1114.wordpress.com/2013/06/24/php-5-3-6-%E7%89%88-pdo-%E9%85%8D%E5%90%88%E5%AD%98%E5%8F%96%E8%B3%87%E6%96%99%E5%BA%AB%E6%99%82%E7%9A%84%E4%B8%AD%E6%96%87%E5%95%8F%E9%A1%8C/
|
||||||
$this->exec('set names utf8');
|
$this->exec('set names utf8');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user