本文整理汇总了PHP中app\Config::getBaseDatos方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getBaseDatos方法的具体用法?PHP Config::getBaseDatos怎么用?PHP Config::getBaseDatos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Config
的用法示例。
在下文中一共展示了Config::getBaseDatos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _conexion
private function _conexion()
{
//$entorno = new Entorno();
//self::$config = $this->config_load($entorno->getEntorno().'app_config');
$configApp = new Config();
$this->config = $configApp->getBaseDatos();
if (empty($this->config['driver'])) {
die('Por favor, establece un controlador de base de datos valido ' . $this->config['driver']);
}
$driver = strtoupper($this->config['driver']);
switch ($driver) {
case 'MYSQL':
$this->_dbHost = $this->config['host'];
$this->_dbbd = $this->config['nombre'];
$this->_dbusuario = $this->config['usuario'];
$this->_dbclave = $this->config['clave'];
$this->pdo = new PDO('mysql:host=' . $this->_dbHost . '; dbname=' . $this->_dbbd, $this->_dbusuario, $this->_dbclave);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->pdo->exec("SET CHARACTER SET utf8");
$this->_cnx = $this->pdo;
break;
default:
die('Base de datos no soporta: ' . $this->config['driver']);
}
}
示例2: Config
<?php
use App\Config;
$configApp = new Config();
$entorno = $configApp->getBaseDatos();
$serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
$serviceContainer->checkVersion('2.0.0-dev');
$serviceContainer->setAdapterClass('default', 'mysql');
$manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
$manager->setConfiguration(array('dsn' => 'mysql:host=' . $entorno['host'] . ';dbname=' . $entorno['nombre'] . ';port=' . $entorno['puerto'], 'user' => $entorno['usuario'], 'password' => $entorno['clave'], 'settings' => array('charset' => $entorno['charset'], 'queries' => array('utf8' => "SET NAMES utf8 COLLATE utf8_unicode_ci, COLLATION_CONNECTION = utf8_unicode_ci, COLLATION_DATABASE = utf8_unicode_ci, COLLATION_SERVER = utf8_unicode_ci")), 'classname' => '\\Propel\\Runtime\\Connection\\ConnectionWrapper'));
$manager->setName('default');
$serviceContainer->setConnectionManager('default', $manager);
$serviceContainer->setDefaultDatasource('default');