#599 | PDO::ATTR_TIMEOUT => 5, |
#600 | ); |
#601 | $link = new PDO("mysql:host=$host;port=$port;dbname=$name;charset=$charset", $user, $pass, $attr); |
#602 | } catch (Exception $e) { |
#603 | throw new Exception('连接数据库服务器失败:'.mb_convert_encoding($e->getMessage(),'UTF-8','GBK')); |
#604 | } |
#605 | if($charset){ |
#606 | $link->query('SET NAMES '.$charset.', sql_mode=""'); |
#607 | }else{ |
#608 | $link->query('SET sql_mode=""'); |