本文整理汇总了PHP中PMF_Db::dbType方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Db::dbType方法的具体用法?PHP PMF_Db::dbType怎么用?PHP PMF_Db::dbType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Db
的用法示例。
在下文中一共展示了PMF_Db::dbType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
/**
* Database factory
*
* @param string $type Database management system type
* @throws PMF_Exception
*
* @return PMF_DB_Driver
*/
public static function factory($type)
{
self::$dbType = $type;
$class = 'PMF_DB_' . ucfirst($type);
if (class_exists($class)) {
self::$instance = new $class();
return self::$instance;
} else {
throw new PMF_Exception('Invalid Database Type: ' . $type);
}
}
示例2: dbSelect
/**
* Database factory
*
* @param string $type Database management system type
*
* @return PMF_Db_Driver
*/
public static function dbSelect($type)
{
self::$dbType = $type;
$file = str_replace('\\', '/', __FILE__);
$dir = substr($file, 0, strrpos($file, "/")) . '/PMF_DB/';
$type = ucfirst($type);
if (file_exists($dir . $type . '.php')) {
require_once $dir . $type . '.php';
$class = 'PMF_DB_' . $type;
self::$instance = new $class();
return self::$instance;
} else {
throw new PMF_Exception('Invalid Database Type: ' . $type);
}
}
示例3: factory
/**
* Database factory
*
* @param string $type Database management system type
*
* @throws PMF_Exception
*
* @return PMF_DB_Driver
*/
public static function factory($type)
{
self::$dbType = $type;
if (0 === strpos($type, 'pdo_')) {
$class = 'PMF_DB_Pdo_' . ucfirst(substr($type, 4));
} else {
$class = 'PMF_DB_' . ucfirst($type);
}
if (class_exists($class)) {
self::$instance = new $class();
return self::$instance;
} else {
throw new PMF_Exception('Invalid Database Type: ' . $type);
}
}