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


PHP vB::config方法代码示例

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


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

示例1: fetch_config

 /**
  * Fetches database/system configuration
  * Code extracted from vB_Registry::fetch_config (class_core)
  */
 private static function fetch_config()
 {
     // Set the default values here.
     $default['Cache']['class'] = vB_Cache::getDefaults();
     // parse the config file
     if (file_exists(CWD . '/' . self::$config_file)) {
         include CWD . '/' . self::$config_file;
     } else {
         if (defined('STDIN')) {
             exit(5);
         }
         die('<br /><br /><strong>Configuration</strong>: includes/config.php does not exist. For a new install click <a href="core/install/makeconfig.php">here</a>');
     }
     // TODO: this should be handled with an exception, the backend shouldn't produce output
     if (empty($config)) {
         // config.php exists, but does not define $config
         if (defined('STDIN')) {
             exit(5);
         }
         die('<br /><br /><strong>Configuration</strong>: includes/config.php exists, but is not in the 3.6+ format. Please convert your config file via the new config.php.new.');
     }
     self::$config = vB_Array::arrayReplaceRecursive($default, $config);
     // if a configuration exists for this exact HTTP host, use it
     if (isset($_SERVER['HTTP_HOST']) and isset(self::$config["{$_SERVER['HTTP_HOST']}"])) {
         self::$config['MasterServer'] = self::$config["{$_SERVER['HTTP_HOST']}"];
     }
     // define table and cookie prefix constants
     define('TABLE_PREFIX', trim(isset(self::$config['Database']['tableprefix']) ? self::$config['Database']['tableprefix'] : ''));
     define('COOKIE_PREFIX', empty(self::$config['Misc']['cookieprefix']) ? 'bb' : self::$config['Misc']['cookieprefix']);
     // Set debug mode, always default this to false unless it is explicitly set to true (see VBV-2948).
     self::$config['Misc']['debug'] = (isset(self::$config['Misc']['debug']) and self::$config['Misc']['debug'] === true) ? true : false;
     // This will not exist if a pre vB5 config file is still in use. @TODO, change the default when everything can cope with a blank setting.
     if (!isset(self::$config['SpecialUsers']['superadmins'])) {
         self::$config['SpecialUsers']['superadmins'] = '1';
         // Not ideal, but some areas (and the upgrader) choke on a blank setting atm.
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:41,代码来源:vb.php


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