本文整理汇总了PHP中Config::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::config方法的具体用法?PHP Config::config怎么用?PHP Config::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* Загрузка конфига
* @param array $config
*/
public static function set($config)
{
if (empty($config)) {
throw new Exception('Class Config: empty array $config');
}
self::$config = $config;
}
示例2: factory
public static function factory()
{
if (!self::$config) {
self::$config = (include APPPATH . '/config.php');
}
return self::$config;
}
示例3: get
public static function get()
{
if (empty(self::$config)) {
self::$config = (require_once GW2STATS_PATH . '/config/config.php');
}
return self::$config;
}
示例4: init
public static function init()
{
if (!self::$config) {
self::$config = (include BASE_PATH . 'config.php');
}
// Incluir la base de datos
include BASE_PATH . 'app/DB.php';
include BASE_PATH . 'app/DBObject.php';
include BASE_PATH . 'app/Query.php';
// Conectamos con la base de datos
DB::config(self::get('database'));
DB::connect();
// Definimos algunas constantes importantes
foreach (array('cache', 'includes', 'models', 'controllers', 'views', 'assets') as $path) {
self::$config['path'][$path . '_orig'] = self::$config['path'][$path];
self::$config['path'][$path] = BASE_PATH . self::get('path.' . $path) . '/';
}
// Cargar los modelos automáticamente
foreach (glob(self::get('path.models') . '*.php', GLOB_NOSORT) as $file) {
include $file;
}
// Configurar el cargado automático de clases
spl_autoload_register(function ($name) {
require Config::get('path.includes') . $name . '.php';
});
Cache::configure(array('cache_path' => self::get('path.cache'), 'expires' => self::get('cache.expires')));
}
示例5: getConfig
public static function getConfig()
{
if (Config::$config == null) {
Config::$config = json_decode(file_get_contents(MAIN_PATH . "/private/config.json"), true);
}
return Config::$config;
}
示例6: get
public static function get($key)
{
if (!self::$config) {
self::$config = (require '../app/config/config.' . Environment::get() . '.php');
}
return self::$config[$key];
}
示例7:
/**
* get_config()
*
* Simple wrapper-function that retrieves the given entry from the
* config-array.
* This is added as a step towards an invisible and protected config-array
*
* @param String $entry_name the name of the config-switch to find
* @return String the config-entry
* @access public
* @throws KeyNotFoundException
*/
static function get_config($entry_name)
{
if (!is_object(Config::$config)) {
Config::$config = new Config_Holder();
}
return Config::$config->getConfigVal($entry_name);
}
示例8: setConfig
/**
* Merges the given array with the config array. It uses the keys/values from config/container.php.
*
* @param array $tconfig
*/
static function setConfig($tconfig)
{
if (!is_array(self::$config)) {
self::loadConfig();
}
self::$config = array_merge(self::$config, $tconfig);
}
示例9: get
public function get($paramId)
{
self::$configFilePath = dirname(__FILE__) . '/../../config/parameters.json';
if (count(self::$config) == 0) {
self::$config = json_decode(file_get_contents(self::$configFilePath));
}
return self::$config->{$paramId};
}
示例10: get
public static function get($config = NULL)
{
if ($config == NULL) {
return new stdObject();
}
self::$config = (require ROOT . DS . 'config' . DS . $config . EXT);
return json_decode(json_encode(self::$config));
}
示例11: init
public static function init()
{
if (Config::config('cache') == true) {
$config = Config::cache();
Loader::core('CacheCarry');
Loader::driver('caches', $config['driver']);
self::$cache = new $config['driver']($config);
}
}
示例12: __construct
function __construct()
{
$rand = rand(0, 1);
if ($rand == 0) {
$this->font = __ROOT__ . parseDir(Config::config('core_dir'), 'libs', 'font') . 'elephant.ttf';
} else {
$this->font = __ROOT__ . parseDir(Config::config('core_dir'), 'libs', 'font') . 'Vineta.ttf';
}
}
示例13: loadFile
public static function loadFile($filename)
{
$ini = @parse_ini_file($filename, true);
if ($ini === FALSE) {
$phpError = error_get_last();
throw new ConfigLoadException('Can\'t load config file: ' . $phpError['message']);
}
self::$config = $ini;
}
示例14: get
public static function get($item)
{
if (isset(self::$config[$item])) {
return self::$config[$item];
}
require 'config.php';
self::$config = $config;
return isset(self::$config[$item]) ? self::$config[$item] : false;
}
示例15: get
public static function get($name)
{
if (null === self::$config) {
self::$config = Db::pairs("SELECT c.nombre, c.valor\n FROM configuracion c\n ORDER BY c.nombre");
}
if (self::$config[$name]) {
return self::$config[$name];
}
return false;
}