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


PHP Bootstrap::config方法代码示例

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


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

示例1: init

 /**
  * Inicia el bootstrap
  */
 public static function init()
 {
     //FIXME dejar esto configurable
     date_default_timezone_set("America/Mexico_City");
     self::$config = (include 'config/application.config.php');
     self::$smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
     self::$listeners = isset($configuration['listeners']) ? $configuration['listeners'] : array();
 }
开发者ID:mrkz8,项目名称:kratos-finder,代码行数:11,代码来源:bootstrap.php

示例2: meta

 /**
  * @return MetaAbstract
  * */
 public function meta()
 {
     $dsName = $this->_bootstrap->config('app.persist.default');
     $config = $this->_bootstrap->config('app.persist')->toArray();
     $pConfig = PersistConfig::factory($dsName, $config);
     $persist = \br\gov\sial\core\persist\database\Connect::factory($pConfig);
     return MetaAbstract::factory($persist);
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:11,代码来源:ControllerAbstract.php

示例3: reload_all_libraries

 /**
  * 重新加载类库
  *
  */
 protected static function reload_all_libraries()
 {
     # 加载类库
     $lib_config = self::$core_config['libraries'];
     # 重置
     self::$include_path['library'] = array();
     foreach (array('autoload', 'cli', 'admin', 'debug', 'rest') as $type) {
         if (!isset($lib_config[$type]) || !$lib_config[$type]) {
             continue;
         }
         if ($type == 'cli') {
             if (!IS_DEBUG) {
                 continue;
             }
         } else {
             if ($type == 'admin') {
                 if (!IS_ADMIN_MODE) {
                     continue;
                 }
             } else {
                 if ($type == 'rest') {
                     if (!IS_REST_MODE) {
                         continue;
                     }
                 } else {
                     if ($type == 'debug') {
                         if (!IS_DEBUG) {
                             continue;
                         }
                     }
                 }
             }
         }
         $libs = array_reverse((array) $lib_config[$type]);
         foreach ($libs as $lib) {
             self::_add_include_path_lib($lib);
         }
     }
     # 处理 library 的config
     $config_files = array();
     self::get_config_file_by_path($config_files, self::$include_path['project'], true);
     self::get_config_file_by_path($config_files, self::$include_path['team-library'], true);
     self::get_config_file_by_path($config_files, self::$include_path['library'], false);
     self::get_config_file_by_path($config_files, self::$include_path['core'], false);
     if ($config_files) {
         # 反向排序,从最后一个开始导入
         $config_files = array_reverse($config_files);
         # 导入config
         self::$config = self::$core_config;
         # 移除特殊的key
         unset(self::$config['core']);
         unset(self::$config['projects']);
         # 载入config
         __include_config_file(self::$config, $config_files);
     }
 }
开发者ID:liuyu121,项目名称:myqee,代码行数:60,代码来源:bootstrap.php

示例4: setup

 /**
  * 系统初始化
  *
  * @param boolean $auto_execute 是否自动运行
  */
 public static function setup($auto_execute = true)
 {
     static $run = null;
     if (!$run) {
         $run = true;
         # 注册自动加载类
         spl_autoload_register(array('Bootstrap', 'auto_load'));
         # 读取配置
         if (!is_file(DIR_SYSTEM . 'config' . EXT)) {
             self::show_error('Please rename the file config.new.php to config.php');
         }
         $include_config_file = function (&$config, $file) {
             include $file;
         };
         self::$config = array('core' => array());
         # 读取主配置
         $include_config_file(self::$config['core'], DIR_SYSTEM . 'config' . EXT);
         # 读Debug配置
         if (isset(self::$config['core']['debug_config']) && self::$config['core']['debug_config'] && is_file(DIR_SYSTEM . 'debug.config' . EXT)) {
             $include_config_file(self::$config['core'], DIR_SYSTEM . 'debug.config' . EXT);
         }
         # DEBUG配置
         if (isset(self::$config['core']['local_debug_cfg']) && self::$config['core']['local_debug_cfg']) {
             if (function_exists('get_cfg_var')) {
                 $open_debug = get_cfg_var(self::$config['core']['local_debug_cfg']) ? 1 : 0;
             } else {
                 $open_debug = 0;
             }
         } else {
             $open_debug = 0;
         }
         /**
          * 判断是否开启了在线调试
          *
          * @return boolean
          */
         $is_online_debug = function () {
             if (IS_SYSTEM_MODE) {
                 if (isset($_SERVER['HTTP_X_MYQEE_SYSTEM_DEBUG']) && $_SERVER['HTTP_X_MYQEE_SYSTEM_DEBUG'] == '1') {
                     return true;
                 } else {
                     return false;
                 }
             }
             if (!isset($_COOKIE['_debug_open'])) {
                 return false;
             }
             if (!isset(Bootstrap::$config['core']['debug_open_password'])) {
                 return false;
             }
             if (!is_array(Bootstrap::$config['core']['debug_open_password'])) {
                 return false;
             }
             foreach (Bootstrap::$config['core']['debug_open_password'] as $user => $pass) {
                 if ($_COOKIE['_debug_open'] == Bootstrap::get_debug_hash($user, $pass)) {
                     return true;
                 }
             }
             return false;
         };
         if ($is_online_debug()) {
             $open_debug == 1 << 1 | $open_debug;
         }
         unset($is_online_debug);
         /**
          * 是否开启DEBUG模式
          *
          *     if (IS_DEBUG>>1)
          *     {
          *         //开启了在线调试
          *     }
          *
          *     if (IS_DEBUG & 1)
          *     {
          *         //本地调试打开
          *     }
          *
          *     if (IS_DEBUG)
          *     {
          *         // 开启了调试
          *     }
          *
          * @var int
          */
         define('IS_DEBUG', $open_debug);
         # 请求模式
         $request_mode = '';
         if (IS_CLI) {
             if (!isset($_SERVER["argv"])) {
                 exit('Err Argv');
             }
             $argv = $_SERVER["argv"];
             //$argv[0]为文件名
             if (isset($argv[1]) && $argv[1] && isset(self::$config['core']['projects'][$argv[1]])) {
                 self::$project = $argv[1];
//.........这里部分代码省略.........
开发者ID:google2013,项目名称:myqee,代码行数:101,代码来源:bootstrap.php

示例5: set_project

 /**
  * 设置项目
  * 可重新设置新项目已实现程序内项目切换,但需谨慎使用
  * @param string $project
  */
 public static function set_project($project)
 {
     if (self::$project == $project) {
         return true;
     }
     static $core_config = null;
     if (null === $core_config) {
         # 记录原始Core配置
         $core_config = self::$config['core'];
     }
     if (!isset($core_config['projects'][$project])) {
         self::_throw_sys_error_msg(__('not found the project: :project.', array(':project' => $project)));
     }
     if (!$core_config['projects'][$project]['isuse']) {
         self::_throw_sys_error_msg(__('the project: :project is not open.', array(':project' => '$project')));
     }
     # 获取core里项目配置
     $project_config = $core_config['projects'][$project];
     # 项目路径
     $project_dir = realpath(DIR_PROJECT . $project_config['dir']);
     if (!$project_dir || !is_dir($project_dir)) {
         self::_throw_sys_error_msg(__('the project dir :dir is not exist.', array(':dir' => $project_config['dir'])));
     }
     $project_dir .= DS;
     self::$project_dir = $project_dir;
     # 记录所有项目设置,当切换回项目时,使用此设置还原
     static $all_prjects_setting = array();
     if (self::$project) {
         # 记录上一个项目设置
         $all_prjects_setting[self::$project] = array('config' => self::$config, 'project_config' => self::$project_config, 'include_path' => self::$include_path, 'file_list' => self::$file_list);
     }
     # 设为当前项目
     self::$project = $project;
     # 记录debug信息
     if (class_exists('Core', false)) {
         Core::debug()->info('程序已切换到了新项目:' . $project);
     }
     if (isset($all_prjects_setting[$project])) {
         # 还原配置
         self::$config = $all_prjects_setting[$project]['config'];
         self::$project_config = $all_prjects_setting[$project]['project_config'];
         self::$include_path = $all_prjects_setting[$project]['include_path'];
         self::$file_list = $all_prjects_setting[$project]['file_list'];
     } else {
         # 合并配置
         $config = $core_config['projects'][$project] + self::$config['core'];
         # 读取项目配置
         if (is_file($project_dir . 'config' . EXT)) {
             self::_include_config_file($config, $project_dir . 'config' . EXT);
         }
         # 读取DEBUG配置
         if (isset(self::$config['core']['debug_config']) && self::$config['core']['debug_config'] && is_file($project_dir . 'debug.config' . EXT)) {
             self::_include_config_file($config, $project_dir . 'debug.config' . EXT);
         }
         # 清理项目配置
         self::$project_config = $config;
         self::$config = array('core' => &self::$project_config);
         unset($config);
         # Builder构建,处理 self::$file_list
         if (self::$project_config['use_bulider'] === 'auto') {
             if (IS_DEBUG) {
                 $usebulider = false;
             } else {
                 $usebulider = true;
             }
         } else {
             $usebulider = (bool) self::$project_config['use_bulider'];
         }
         $project_filelist = DIR_BULIDER . self::$project . DS . 'project_all_files_list' . EXT;
         if (true === $usebulider && !IS_CLI && is_file($project_filelist)) {
             # 读取文件列表
             self::_include_config_file(self::$file_list, $project_filelist);
         }
         # 设置包含目录
         self::$include_path = self::get_project_include_path($project);
     }
     if (isset(self::$project_config['error_reporting'])) {
         error_reporting(self::$project_config['error_reporting']);
     }
     # 时区设置
     if (isset(self::$project_config['timezone'])) {
         date_default_timezone_set(self::$project_config['timezone']);
     }
     if (class_exists('Core', false)) {
         # 输出调试信息
         if (IS_DEBUG) {
             Core::debug()->group('当前加载目录');
             foreach (self::$include_path as $value) {
                 Core::debug()->log(Core::debug_path($value));
             }
             Core::debug()->groupEnd();
         }
         Core::ini_library();
     }
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:100,代码来源:bootstrap.php


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