如何将数据库类与数组连接起来

How can i connect into another script my database class function? I need to make it without change every file with the connection file.

Here is my config file(conn.php):

define('DB_HOST', "localhost"); 
define('DB_TYPE', "mysql"); 
define('DB_USER', "user"); 
define('DB_PASS', "123456"); 
define('DB_NAME', "dbuser"); 

Here is the config I need to change to the DEFINE connection:

include_once('../conn.php'); # is the file with the connection

$config = array();
$config['database']['host'] = 'localhost';    # I tried with .DB_HOST.
$config['database']['user'] = '';        # I tried with .DB_TYPE.
$config['database']['password']  = '';      
$config['database']['database'] = '';      

You've defined constants, so there is no need to wrap it in quotes, or concatenation.

Using quotes would be treated as a string literals.

$config = array();
$config['database']['host'] = DB_HOST;
$config['database']['user'] = DB_USER;
$config['database']['password']  = DB_PASS;      
$config['database']['database'] = DB_NAME;

References: