本文整理汇总了PHP中CDbConnection::getAvailableDrivers方法的典型用法代码示例。如果您正苦于以下问题:PHP CDbConnection::getAvailableDrivers方法的具体用法?PHP CDbConnection::getAvailableDrivers怎么用?PHP CDbConnection::getAvailableDrivers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDbConnection
的用法示例。
在下文中一共展示了CDbConnection::getAvailableDrivers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($scenario = 'database')
{
$drivers = array();
if (extension_loaded('pdo')) {
$drivers = CDbConnection::getAvailableDrivers();
}
foreach ($drivers as $driver) {
if (isset($this->db_names[$driver])) {
$this->supported_db_types[$driver] = $this->db_names[$driver];
}
}
asort($this->supported_db_types);
parent::__construct();
// Default is database
$this->setScenario($scenario);
}
示例2: rules
public function rules()
{
return array(array('dbtype, dblocation, dbname, dbuser', 'required', 'on' => 'database'), array('dbpwd, dbprefix', 'safe', 'on' => 'database'), array('dbtype', 'in', 'range' => array_keys(CDbConnection::getAvailableDrivers()), 'on' => 'database'), array('adminLoginName, adminName, siteName, confirmPwd', 'safe', 'on' => 'optional'), array('adminEmail', 'email', 'on' => 'optional'), array('surveylang', 'in', 'range' => array_keys(getLanguageData(true, Yii::app()->session['installerLang'])), 'on' => 'optional'), array('adminLoginPwd', 'compare', 'compareAttribute' => 'confirmPwd', 'message' => Yii::app()->getController()->lang->gT('Passwords do not match!'), 'strict' => true, 'on' => 'optional'));
}