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


PHP Basic::setConstant方法代码示例

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


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

示例1: parsIni

 /**
     Parses the configuration file.
     @param string $filename Path to the configuration file.
     @return null.
     **/
 public static function parsIni($filename)
 {
     if (empty($filename) || !file_exists($filename)) {
         return "Configuration not found";
     }
     $config = parse_ini_file($filename, true);
     Basic::setConstant("DEFAULT_SOCKET_TIMEOUT", Basic::getConfigKey($config, 'general', 'socketTimeout'), 10);
     $phpCommand = Basic::getConfigKey($config, 'general', 'phpCommand');
     if (!empty($phpCommand)) {
         static::$phpCommand = $phpCommand;
     }
     $disablePanelTitle = Basic::getConfigKey($config, 'general', 'disablePanelTitle');
     if (!empty($disablePanelTitle)) {
         static::$disablePanelTitle = $disablePanelTitle;
     }
     Basic::setConstant("TMP_FOLDER", Basic::getConfigKey($config, 'general', 'tmpFolder'), sys_get_temp_dir());
     Basic::setConstant("SPECIAL_CHAR", Basic::getConfigKey($config, 'general', 'specialChar'), "&");
     Basic::setConstant("DATABASE_TYPE", strtolower(Basic::getConfigKey($config, 'general', 'databaseType')), "influxdb");
     Basic::setConstant("FORECAST_DATASOURCE_NAME", strtolower(Basic::getConfigKey($config, 'general', 'forecastDatasourceName')), "nagflux_forecast");
     Basic::setConstant("URL", Basic::getConfigKey($config, DATABASE_TYPE, 'url'), "http://127.0.0.1:8086/query?db=nagflux");
     define('INFLUXDB', 'influxdb');
     define('ELASTICSEARCH', 'elasticsearch');
     if (DATABASE_TYPE == INFLUXDB && preg_match(";db=(\\w*);", URL, $matches)) {
         define('INFLUXDB_DB', $matches[1]);
     } elseif (DATABASE_TYPE == ELASTICSEARCH) {
         $path = parse_url(URL, PHP_URL_PATH);
         if ($path) {
             define('ELASTICSEARCH_INDEX', ltrim($path, '/'));
         }
     }
     Basic::setConstant("HOSTCHECK_ALIAS", Basic::getConfigKey($config, DATABASE_TYPE, 'hostcheckAlias'), "hostcheck");
     Basic::setConstant("DEFAULT_TEMPLATE_FOLDER", Basic::getConfigKey($config, 'folder', 'defaultTemplateFolder'), "histou/templates/default/");
     Basic::setConstant("CUSTOM_TEMPLATE_FOLDER", Basic::getConfigKey($config, 'folder', 'customTemplateFolder'), "histou/templates/custom/");
     Basic::setConstant("FORECAST_TEMPLATE_FOLDER", Basic::getConfigKey($config, 'folder', 'forecastTemplateFolder'), "histou/forecasts/");
 }
开发者ID:Griesbacher,项目名称:histou,代码行数:40,代码来源:basic.php


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