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.
 
 
 
 
 
 

25 rivejä
980 B

  1. <?php
  2. if (empty($_SERVER['APPLICATION_ENV']) || $_SERVER['APPLICATION_ENV'] == 'production') {
  3. defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
  4. } else {
  5. defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'dev');
  6. }
  7. $getDbConfig = require dirname(dirname(__DIR__)) . '/config/dbConfig/db.' . APPLICATION_ENV . '.config.php';
  8. $config = $getDbConfig['CST'];
  9. define("MYSQL_HOST", $config['host']);
  10. define("MYSQL_USER", $config['user']);
  11. define("MYSQL_PASSWORD", $config['pwd']);
  12. define("MYSQL_DB", $config['db']);
  13. define("MYSQL_PORT", $config['port']);
  14. function conn()
  15. {
  16. $port = defined('MYSQL_PORT') ? MYSQL_PORT : 3306;
  17. try {
  18. $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"));
  19. return $pdo;
  20. } catch (PDOException $e) {
  21. write_log('ctsdata_test new PDO failed:' . $e->getMessage());
  22. }
  23. }
  24. ?>