本文整理匯總了PHP中loader::database方法的典型用法代碼示例。如果您正苦於以下問題:PHP loader::database方法的具體用法?PHP loader::database怎麽用?PHP loader::database使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類loader
的用法示例。
在下文中一共展示了loader::database方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _createtable
function _createtable($sql)
{
$db =& loader::database();
$type = strtoupper(preg_replace("/^\\s*CREATE TABLE\\s+.+\\s+\\(.+?\\).*(ENGINE|TYPE)\\s*=\\s*([a-z]+?).*\$/isU", "\\2", $sql));
$type = in_array($type, array('MYISAM', 'HEAP', 'MEMORY')) ? $type : 'MYISAM';
return preg_replace("/^\\s*(CREATE TABLE\\s+.+\\s+\\(.+?\\)).*\$/isU", "\\1", $sql) . ($db->version() > '4.1' ? " ENGINE={$type} DEFAULT CHARSET=utf8" : " TYPE={$type}");
}
示例2: __constuct
function __constuct()
{
parent::__constuct();
// Call the Model constructor
loader::database();
// Connect to current database setting.
}
示例3: plugin
function plugin($config = null)
{
if (!is_null($config)) {
$this->config = array_merge($this->config, $config);
}
$this->db =& loader::database();
$this->plugin_mgr =& loader::lib('plugin');
}
示例4: pagecore
function pagecore()
{
$this->output =& loader::lib('output');
$this->db =& loader::database();
$this->user =& loader::model('user');
$this->setting =& loader::model('setting');
$this->plugin =& loader::lib('plugin');
$this->plugin->trigger('controller_init');
}
示例5: __construct
public function __construct()
{
loader::database("db");
}
示例6: modelfactory
function modelfactory()
{
$this->db =& loader::database();
}
示例7: plugin_cla
function plugin_cla()
{
$this->db =& loader::database();
}
示例8: show_header
$step = $step + 1;
show_header();
show_install();
$tablepre = 'meu_';
$CONFIG['database']['default']['adapter'] = 'sqlite';
$CONFIG['database']['default']['dbpath'] = $dst_dbfile;
$CONFIG['database']['default']['pre'] = $tablepre;
$CONFIG['cookie_name'] = 'MPIC_' . random(4);
$CONFIG['cookie_auth_key'] = random(12);
$CONFIG['img_engine'] = class_exists('imagick') ? 'imagick' : 'gd';
save_config_file($confile, $CONFIG, $default_config);
if (file_exists(ROOTDIR . $dst_dbfile)) {
@unlink(ROOTDIR . $dst_dbfile);
}
@touch(ROOTDIR . $dst_dbfile);
$db =& loader::database();
$sql = file_get_contents($sqlite_sqlfile);
$sql = str_replace("\r\n", "\n", $sql);
runquery($sql);
}
$datasql = file_get_contents($datasqlfile);
runquery($datasql);
$sql = $db->insert('#@nav', array('type' => 0, 'name' => lang('home'), 'url' => 'default', 'sort' => '100'));
$db->query($sql);
$sql = $db->insert('#@nav', array('type' => 0, 'name' => lang('tags'), 'url' => 'tags', 'sort' => '100'));
$db->query($sql);
$sql = $db->insert('#@nav', array('type' => 0, 'name' => lang('category'), 'url' => 'category', 'sort' => '100'));
$db->query($sql);
showjsmessage(lang('install_data_sql') . lang('succeed'));
cleardir(ROOTDIR . 'cache/data');
cleardir(ROOTDIR . 'cache/templates');