0
我有CodeIgnitor安裝程序根據它加載的子域來選擇數據庫(如下所示)。代碼點火器選擇基於http_host的數據庫
由於我使用臨時表和不同的數據庫,因此我開啓了持續連接。它似乎工作正常,但我只是想知道是否有任何潛在的問題。 (我也用數據庫備份會話)
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
$active_group = "default";
$active_record = TRUE;
$phppos_client_name = substr($_SERVER['HTTP_HOST'], 0, strpos($_SERVER['HTTP_HOST'], '.'));
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "USER";
$db['default']['password'] = "PASSWORD";
$db['default']['database'] = 'db_'.$phppos_client_name;
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "phppos_";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
/* End of file database.php */
/* Location: ./application/config/database.php */