当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Config_Ini::setReadOnly方法代码示例

本文整理汇总了PHP中Zend_Config_Ini::setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Ini::setReadOnly方法的具体用法?PHP Zend_Config_Ini::setReadOnly怎么用?PHP Zend_Config_Ini::setReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Config_Ini的用法示例。


在下文中一共展示了Zend_Config_Ini::setReadOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _loadConfig

 /**
  * Добавляет конфиг в реестр, сливает с конфигом-патчем (если есть)
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     $environment = $this->getEnvironment();
     $config = new Zend_Config_Ini($file, $environment, true);
     # Получаем путь к дополнительному конфигу
     $additionConfig = isset($config->config) ? $config->config : dirname($file) . '/_' . basename($file);
     if (is_readable($additionConfig)) {
         try {
             $configCustom = new Zend_Config_Ini($additionConfig, $environment);
             $config->merge($configCustom);
         } catch (Zend_Config_Exception $e) {
         }
     }
     if (isset($config->config)) {
         unset($config->config);
     }
     $config->setReadOnly();
     Zend_Registry::set('config', $config);
     return $config->toArray();
 }
开发者ID:eugenzor,项目名称:zfhrtool,代码行数:27,代码来源:Application.php

示例2: loadConfig

 /**
  * Loads the configuration
  *
  * First, the main configuration file - "application.ini" - is loaded from
  * the root of the configs directory. Second, all other configuration files,
  * if any, are loaded recursively - except for "user.ini". Third, the
  * developer-specific configuration file - "user.ini" - is loaded. This
  * file overrides any setting in the previously loaded files and is only
  * regarded in development and testing mode.
  *
  * This method must be 'public static' - Zend_Cache_Class requires so.
  * However, users shouldn't call it directly; use getConfig() instead.
  *
  * @param string $section
  * @return Zend_Config
  */
 public static function loadConfig($section)
 {
     // Load the main configuration file
     $configFile = GLITCH_CONFIGS_PATH . DIRECTORY_SEPARATOR . self::FILENAME_APPLICATION;
     $ini = new Zend_Config_Ini($configFile, $section, array('allowModifications' => true));
     // Recursively load all other ini files, if any, but exclude the special cases
     $pattern = '~^(?!' . preg_quote(self::FILENAME_APPLICATION) . '|' . preg_quote(self::FILENAME_USER) . ').+\\.ini$~';
     $dirIterator = new RecursiveDirectoryIterator(GLITCH_CONFIGS_PATH, RecursiveDirectoryIterator::KEY_AS_FILENAME);
     $recursiveIterator = new RecursiveIteratorIterator($dirIterator);
     $iterator = new RegexIterator($recursiveIterator, $pattern, RegexIterator::MATCH, RegexIterator::USE_KEY);
     foreach ($iterator as $file) {
         $ini->merge(new Zend_Config_Ini($file->getPathname(), $section));
     }
     // Optionally load developer-specific settings, overriding previous settings
     $configFile = GLITCH_CONFIGS_PATH . DIRECTORY_SEPARATOR . self::FILENAME_USER;
     if (('development' == $section || 'testing' == $section) && file_exists($configFile)) {
         $ini->merge(new Zend_Config_Ini($configFile, $section));
     }
     if ('testing' != $section) {
         $ini->setReadOnly();
     }
     return $ini;
 }
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:39,代码来源:Ini.php

示例3: explode

$locale = new Zend_Locale('fr_CA');
Zend_Registry::set('Zend_Locale', $locale);
// loading configuration
$host = explode('.', $_SERVER['HTTP_HOST']);
$envVar = 'production';
if (in_array('sandboxes', $host) || in_array('localhost', $host)) {
    $envVar = 'development';
} elseif (in_array('staging', $host)) {
    $envVar = 'staging';
}
$config = new Zend_Config_Ini("{$application_path}/config.ini", 'general', true);
$imgCfg = new Zend_Config_Ini("{$application_path}/config.ini", 'Images', true);
$envCfg = new Zend_Config_Ini("{$application_path}/config.ini", $envVar);
$config->merge($imgCfg);
$config->merge($envCfg);
$config->setReadOnly();
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
// establishment of the database
$db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
$db->query('SET NAMES utf8');
$registry->set('db', $db);
$registry->set('siteName', $config->site->title);
$registry->set('application_path', $application_path);
$registry->set('orders_path', $orders_path);
$registry->set('document_root', "{$rootDir}/{$config->document_root}");
$registry->set('web_root', $web_root);
$registry->set('www_root', $web_root);
$registry->set('absolute_web_root', $absolute_web_root);
$registry->set('lucene_index', realpath(dirname(__FILE__)) . "/indexation/all_index");
开发者ID:anunay,项目名称:stentors,代码行数:31,代码来源:index.php


注:本文中的Zend_Config_Ini::setReadOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。