當前位置: 首頁>>代碼示例>>PHP>>正文


PHP db_factory::get_instance方法代碼示例

本文整理匯總了PHP中db_factory::get_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP db_factory::get_instance方法的具體用法?PHP db_factory::get_instance怎麽用?PHP db_factory::get_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在db_factory的用法示例。


在下文中一共展示了db_factory::get_instance方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct()
 {
     if (!isset($this->db_config[$this->db_setting])) {
         $this->db_setting = 'default';
     }
     //$this->table_name = $this->table_name;
     $this->db = db_factory::get_instance($this->db_config)->get_database($this->db_setting);
 }
開發者ID:liuguogen,項目名稱:weixin,代碼行數:8,代碼來源:model.class.php

示例2: __construct

 function __construct()
 {
     //$this->update_log_db = bpBase::loadModel('update_log_model');
     parent::__construct();
     $checkAccess = $this->exitWithoutAccess('system', 'manage');
     $this->dbConfig = array('default' => array('hostname' => DB_HOSTNAME, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'tablepre' => TABLE_PREFIX, 'charset' => DB_CHARSET, 'type' => 'mysql', 'debug' => DEBUG, 'pconnect' => 0, 'autoconnect' => 0));
     bpBase::loadSysClass('db_factory');
     $this->db = db_factory::get_instance($this->dbConfig)->get_database('default');
 }
開發者ID:ailingsen,項目名稱:pigcms,代碼行數:9,代碼來源:database.php

示例3: __construct

 public function __construct($db_config = '', $table_name = '')
 {
     //4.13  增加M函數功能,
     $this->db_config = $db_config ? $db_config : $this->db_config;
     //4.13
     $this->table_name = $table_name ? $table_name : $this->table_name;
     //4.13
     if (!isset($this->db_config[$this->db_setting])) {
         $this->db_setting = 'default';
     }
     $this->table_name = $this->db_config[$this->db_setting]['tablepre'] . $this->table_name;
     $this->db_tablepre = $this->db_config[$this->db_setting]['tablepre'];
     $this->db = db_factory::get_instance($this->db_config)->get_database($this->db_setting);
 }
開發者ID:zhouzhouxs,項目名稱:Progect,代碼行數:14,代碼來源:model.class.php

示例4: testdb

 public static function testdb($dbtype, $dbhost, $dbuser, $dbpw, $dbname)
 {
     global $con;
     $db_conf = array();
     $db_conf['import_array'] = array();
     $db_conf['import_array']['type'] = $dbtype;
     $db_conf['import_array']['hostname'] = $dbhost;
     $db_conf['import_array']['username'] = $dbuser;
     $db_conf['import_array']['password'] = $dbpw;
     $db_conf['import_array']['database'] = $dbname;
     //$db_conf['import_array']['charset']= $import_info[dbcharset];
     //返回一個當前配置所需要的數據庫連接
     pc_base::load_sys_class('db_factory');
     $thisdb = db_factory::get_instance($db_conf)->get_database('import_array');
     $link = $thisdb->connect();
     if ($link) {
         return 'OK';
     } else {
         return 'false';
     }
 }
開發者ID:ahmatjan,項目名稱:huluphp,代碼行數:21,代碼來源:import_test.class.php

示例5: public_repair

 /**
  * 數據庫修複、優化
  */
 public function public_repair()
 {
     $database = pc_base::load_config('database');
     $tables = $_POST['tables'] ? $_POST['tables'] : trim($_GET['tables']);
     $operation = trim($_GET['operation']);
     $pdo_name = trim($_GET['pdo_name']);
     $this->db = db_factory::get_instance($database)->get_database($pdo_name);
     $tables = is_array($tables) ? implode(',', $tables) : $tables;
     if ($tables && in_array($operation, array('repair', 'optimize'))) {
         $this->db->query("{$operation} TABLE {$tables}");
         showmessage(L('operation_success'), '?m=admin&c=database&a=export&pdoname=' . $pdo_name);
     } elseif ($tables && $operation == 'showcreat') {
         $this->db->query("SHOW CREATE TABLE {$tables}");
         $structure = $this->db->fetch_next();
         $structure = $structure['Create Table'];
         $show_header = true;
         include $this->admin_tpl('database_structure');
     } else {
         showmessage(L('select_tbl'), '?m=admin&c=database&a=export&pdoname=' . $pdo_name);
     }
 }
開發者ID:zhangjSir,項目名稱:JinMaSite,代碼行數:24,代碼來源:database.php

示例6: define

define('IN_WX', true);
define('WX_PATH', substr(dirname(__FILE__), 0, -8) . DIRECTORY_SEPARATOR);
//網站真實路徑
define('SITE_URL', 'http://www.cathassist.org/');
//站點訪問路徑
define('ERRORLOG', false);
define('GZIP', true);
ERRORLOG ? set_error_handler('my_error_handler') : error_reporting(E_ERROR | E_WARNING | E_PARSE);
//設置本地時差
function_exists('date_default_timezone_set') && date_default_timezone_set('Etc/GMT-8');
define('CHARSET', 'utf-8');
//輸出頁麵字符集
header('Content-type: text/html; charset=' . CHARSET);
if (GZIP && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
} else {
    ob_start();
}
require WX_PATH . 'include' . DIRECTORY_SEPARATOR . 'define.php';
require WX_PATH . 'include' . DIRECTORY_SEPARATOR . 'global.func.php';
//加載公共方法
require WX_PATH . 'include' . DIRECTORY_SEPARATOR . 'db_factory.class.php';
//加載數據庫工廠類
//實現化數據庫類
$db = db_factory::get_instance()->get_database('default');
if (!get_magic_quotes_gpc()) {
    $_POST = new_addslashes($_POST);
    $_GET = new_addslashes($_GET);
    $_REQUEST = new_addslashes($_REQUEST);
    $_COOKIE = new_addslashes($_COOKIE);
}
開發者ID:gaoerjun,項目名稱:Web,代碼行數:31,代碼來源:common.inc.php

示例7: init_cmsware_db

 private function init_cmsware_db()
 {
     pc_base::load_sys_class('db_factory', '', 0);
     $this->cmsware_db_config = pc_base::load_config('database');
     $this->cmsware_db_setting = 'default';
     $this->cmsware_db = db_factory::get_instance($this->cmsware_db_config)->get_database($this->cmsware_db_setting);
     $this->cmsware_db_tablepre = $this->cmsware_db_config[$this->cmsware_db_setting]['tablepre'];
     $this->obj_category = pc_base::load_model('category_model');
     $this->obj_model = pc_base::load_model('sitemodel_model');
 }
開發者ID:lestatmq,項目名稱:cms,代碼行數:10,代碼來源:content_tag.class.php


注:本文中的db_factory::get_instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。