本文整理汇总了PHP中CFactory::loadConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::loadConfig方法的具体用法?PHP CFactory::loadConfig怎么用?PHP CFactory::loadConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::loadConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param array $config
*/
function __construct($config = array())
{
$this->_config = array_merge($this->_config, $config);
if (empty($this->_config)) {
$this->_config = CFactory::loadConfig('sessionConfig');
}
}
示例2: __construct
private function __construct($config)
{
if (!$config) {
$config = CFactory::loadConfig('memcache');
}
$this->config = array_merge($this->config, $config);
$this->memcache = new Memcache();
foreach ($this->config['servers'] as $es) {
$this->memcache->addserver($es['host'], $es['port']);
}
}
示例3: getInstance
/**
* @param array $cfg
* @return CRedis
*/
static function getInstance($cfg = array(), $reconnect = false)
{
if (!self::$_config) {
if (!$cfg) {
$cfg = CFactory::loadConfig('redis');
} else {
self::$_config = $cfg;
}
}
if (null == self::$_instacne) {
self::$_instacne = new self($cfg, $reconnect);
}
return self::$_instacne;
}
示例4: define
<?php
/**
* a demo for index php
*/
define('FRAMEWORK_ROOT', dirname(__FILE__) . '/../framework');
define('APP_ROOT', dirname(__FILE__) . '/../app');
require_once FRAMEWORK_ROOT . '/CApp.php';
//include the app config file
CFactory::loadConfig();
$app = CApp::getInstance();
//注入extension模块
if ($extensions = CFactory::loadConfig('extensions')) {
if (!empty($extensions['filter'])) {
//filter
foreach ($extensions['filter'] as $efilter) {
$app->_filter->registerFilter(new $efilter());
}
}
if (!empty($extensions['router'])) {
//router
$app->_router = new $extensions['router']();
}
}
$app->run();
示例5: reConnectDb
/**
* 重新实例化db
*/
function reConnectDb()
{
$dbconfig = CFactory::loadConfig('db');
$this->_db = null;
$this->_db = $this->getDb($dbconfig, true);
}
示例6: responseRedirect
/**
* 跳转
*/
function responseRedirect()
{
if ($this->_config['urlWhiteList']) {
$urlWhiteList = CFactory::loadConfig('urlWhiteList', 'whiteList/url.php');
if (!in_array($this->_ret, $urlWhiteList)) {
throw new Exception('redirect url not allowd');
}
}
header('Location:' . $this->_ret);
}