#662 | PDO::ATTR_TIMEOUT => 5, |
#663 | ]; |
#664 | $link = new PDO("mysql:host=$host;port=$port;dbname=$name;charset=$charset", $user, $pass, $attr); |
#665 | } catch (Exception $e) { |
#666 | throw new Exception('连接数据库服务器失败:' . mb_convert_encoding($e->getMessage(), 'UTF-8', 'GBK')); |
#667 | } |
#668 | if ($charset) { |
#669 | $link->query('SET NAMES ' . $charset . ', sql_mode=""'); |
#670 | } else { |
#671 | $link->query('SET sql_mode=""'); |