本文整理匯總了PHP中erLhcoreClassInstance::instanceChat方法的典型用法代碼示例。如果您正苦於以下問題:PHP erLhcoreClassInstance::instanceChat方法的具體用法?PHP erLhcoreClassInstance::instanceChat怎麽用?PHP erLhcoreClassInstance::instanceChat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類erLhcoreClassInstance
的用法示例。
在下文中一共展示了erLhcoreClassInstance::instanceChat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setupInstance
public static function setupInstance($db)
{
$parts = explode('.', $_SERVER['HTTP_HOST']);
$subdomain = array_shift($parts);
$items = erLhcoreClassModelInstance::getList(array('filter' => array('address' => $subdomain)));
if (!empty($items)) {
erLhcoreClassInstance::$instanceChat = array_shift($items);
$cfg = erConfigClassLhConfig::getInstance();
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
} else {
$cfg = erConfigClassLhConfig::getInstance();
header('Location: ' . $cfg->getSetting('site', 'seller_url'));
exit;
}
}
示例2: setupInstance
public static function setupInstance($db)
{
if (isset($_SERVER['HTTP_HOST'])) {
$cfg = erConfigClassLhConfig::getInstance();
$subdomain = str_replace('.' . $cfg->getSetting('site', 'seller_domain'), '', $_SERVER['HTTP_HOST']);
$session = erLhcoreClassInstance::getSession();
$q = $session->createFindQuery('erLhcoreClassModelInstance');
$q->where($q->expr->eq('address', $q->bindValue($subdomain)) . ' OR (full_domain = 1 AND ' . $q->expr->eq('address', $q->bindValue($_SERVER['HTTP_HOST'])) . ')');
$items = $session->find($q);
if (!empty($items)) {
erLhcoreClassInstance::$instanceChat = array_shift($items);
$db->query('USE ' . $cfg->getSetting('db', 'database_user_prefix') . erLhcoreClassInstance::$instanceChat->id);
} else {
header('Location: ' . $cfg->getSetting('site', 'seller_url'));
exit;
}
}
}