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


PHP SiteConfig::addFile方法代码示例

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


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

示例1: __construct

 /**
  * Creates a new site:
  *   starts the timing clock (if enabled)
  *   creates the SiteLayout if not set
  *   sets up config
  */
 private function __construct()
 {
     if (isset(self::$TheSite)) {
         throw new RuntimeException('Site already set to ' . get_class(self::$TheSite));
     }
     self::$TheSite = $this;
     set_error_handler(array($this, 'dispatchError'), E_ALL | E_RECOVERABLE_ERROR);
     set_exception_handler(array($this, 'dispatchException'));
     $start = array(microtime(true), 'start');
     $this->timePoint('start');
     if (!isset($this->url)) {
         $this->url = dirname($_SERVER['PHP_SELF']);
         if ($this->url == '/') {
             $this->url = '';
         }
     }
     $proto = 'http';
     $port = '';
     if (isset($_SERVER['SERVER_PORT'])) {
         if ($_SERVER['SERVER_PORT'] == 443) {
             $proto = 'https';
         } elseif ($_SERVER['SERVER_PORT'] != 80) {
             $port = ':' . $_SERVER['SERVER_PORT'];
         }
     }
     $this->serverUrl = "{$proto}://" . $_SERVER['SERVER_NAME'] . $port;
     try {
         if (!isset($this->layout)) {
             $this->layout = new SiteLayout($this);
         }
         // The log starts off in an unconfigured state where it accumulates
         // messages until configuration is done and it's told what to do with
         // them; however if something goes wrong early on, it dumps all logged
         // messages
         $this->log = new SiteLog($this);
         $this->config = new SiteConfig($this);
         $this->config->addFile(Loader::$FrameworkPath . '/config.ini');
         new SiteModuleLoader($this);
         $this->dispatchCallback('onConfig', $this);
         $this->config->addFile(Loader::$LocalPath . '/config.ini');
         $this->config->addFile(Loader::$Base . '/siteconfig.ini');
         $this->config->compile();
         $this->dispatchCallback('onPostConfig', $this);
     } catch (SiteConfigParseException $ex) {
         $this->printErrorPage('Error loading onfiguration', "<h1>Error loading configuration:</h1>\n" . "<pre>" . $ex->getMessage() . "</pre>\n");
         exit(1);
     }
     $this->timing = $this->isDebugMode();
     if ($this->timing) {
         array_push($this->timePoints, $start);
     }
 }
开发者ID:bprudent,项目名称:framework,代码行数:58,代码来源:Site.php


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