You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
414 B

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once __DIR__.'/Config.php';
  7. function conn(){
  8. $port=defined('MYSQL_PORT')?MYSQL_PORT:3306;
  9. try {
  10. $pdo=new PDO("mysql:host=".MYSQL_HOST.";port=".$port.";dbname=".MYSQL_DB, MYSQL_USER, MYSQL_PASSWORD,array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8"));
  11. return $pdo;
  12. }catch (PDOException $e){
  13. writeLog('new PDO failed:'.$e->getMessage());
  14. }
  15. }