Db::__construct PHP Méthode

__construct() public méthode

架构函数
public __construct ( array $config = '' )
$config array 数据库配置数组
    public function __construct($config = '')
    {
        // if (!extension_loaded('mysql')) {
        //     throw_exception(L('_NOT_SUPPORT_').':mysql');
        // }
        $this->debug = isset($_GET['debug']) ? true : C('APP_DEBUG');
        $this->config = $this->parseConfig($config);
    }

Usage Example

 public function __construct(array $db_settings, RegistryInterface $registry)
 {
     $db_setting = array('server' => $db_settings['server'], 'database' => $db_settings['db'], 'username' => $db_settings['db_cred']['user']['user'], 'password' => $db_settings['db_cred']['user']['password']);
     //I know; the credentials seem too long
     parent::__construct($db_setting);
     $this->registry = $registry;
 }
All Usage Examples Of Db::__construct