本文整理匯總了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);
}
}