當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Bootstrap::include_path方法代碼示例

本文整理匯總了PHP中Bootstrap::include_path方法的典型用法代碼示例。如果您正苦於以下問題:PHP Bootstrap::include_path方法的具體用法?PHP Bootstrap::include_path怎麽用?PHP Bootstrap::include_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bootstrap的用法示例。


在下文中一共展示了Bootstrap::include_path方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setup_by_url


//.........這裏部分代碼省略.........
                     } else {
                         # /開頭的後台URL
                         $admin_url[] = $admin_url;
                     }
                 }
             }
             if ($item['url']) {
                 if (!is_array($item['url'])) {
                     $item['url'] = array($item['url']);
                 }
                 foreach ($item['url'] as $url) {
                     if (($path_info = $get_path_info($url)) != false) {
                         self::$project = $project;
                         self::$path_info = $path_info;
                         self::$base_url = $url;
                         if ($admin_url) {
                             foreach ($admin_url as $url2) {
                                 # 處理後台URL不是 http:// 或 https:// 開頭的形式
                                 if (($path_info_admin = $get_path_info($url2)) != false) {
                                     self::$path_info = $path_info_admin;
                                     self::$base_url .= ltrim($url2, '/');
                                     $request_mode = 'admin';
                                     break 3;
                                 }
                             }
                         }
                         break 2;
                     }
                 }
             }
         }
     }
     if (self::$project) {
         $project_dir = DIR_PROJECT . self::$project . DS;
         if (!is_dir($project_dir)) {
             self::show_error('not found the project: :project', array(':project' => self::$project));
         }
         # 根據URL尋找到了項目
         self::$include_path = array_merge(array('\\project\\' . self::$project . '\\' => $project_dir), self::$include_path);
     } else {
         if (isset(self::$config['core']['url']['admin']) && self::$config['core']['url']['admin'] && ($path_info = $get_path_info(self::$config['core']['url']['admin'])) != false) {
             self::$path_info = $path_info;
             self::$base_url = self::$config['core']['url']['admin'];
             $request_mode = 'admin';
         } else {
             if (isset(self::$config['core']['apps_url']) && is_array(self::$config['core']['apps_url']) && self::$config['core']['apps_url']) {
                 foreach (self::$config['core']['apps_url'] as $app => $urls) {
                     if (!$urls) {
                         continue;
                     }
                     if (!preg_match('#^[a-z0-9_]+//[a-z0-9]+$#i', $app)) {
                         continue;
                     }
                     if (!is_array($urls)) {
                         $urls = array($urls);
                     }
                     foreach ($urls as $url) {
                         if (($path_info = $get_path_info($url)) != false) {
                             self::$app = $app;
                             self::$path_info = $path_info;
                             self::$base_url = $url;
                             break 2;
                         }
                     }
                 }
             }
             if (null === self::$app) {
                 # 沒有相關應用
                 if (isset(self::$config['core']['url']['apps']) && self::$config['core']['url']['apps']) {
                     if (($path_info = $get_path_info(self::$config['core']['url']['apps'])) != false) {
                         # 匹配到應用默認目錄
                         $path_info = trim($path_info, '/');
                         self::$app = true;
                         if ($path_info) {
                             $path_info_arr = explode('/', $path_info);
                             if (count($path_info_arr) >= 2) {
                                 $app = array_shift($path_info_arr) . '/' . array_shift($path_info_arr);
                                 if (preg_match('#^[a-z0-9_]+//[a-z0-9]+$#i', $app)) {
                                     $path_info = '/' . implode('/', $path_info_arr);
                                     self::$app = $app;
                                 }
                             }
                         }
                         self::$path_info = $path_info;
                         self::$base_url = self::$config['core']['url']['apps'];
                         $request_mode = 'app';
                     }
                 }
             }
             if (self::$app && true !== self::$app) {
                 # 已獲取到APP
                 $app_dir = DIR_APPS . self::$app . DS;
                 if (!is_dir($app_dir)) {
                     self::show_error('can not found the app: :app', array(':app' => self::$app));
                 }
                 $request_mode = 'app';
             }
         }
     }
 }
開發者ID:google2013,項目名稱:myqee,代碼行數:101,代碼來源:bootstrap.php

示例2: find_lang_files

 /**
  * 獲取語言包文件和修改時間
  *
  * @return array array('files'=>array(), 'last_mtime'=>0);
  */
 protected static function find_lang_files()
 {
     if (self::$core_initialized) {
         $accept_language = I18n::accept_language();
         $include_path = Core::include_path();
     } else {
         $accept_language = self::accept_language();
         $include_path = Bootstrap::include_path();
     }
     $accept_language = array_reverse($accept_language);
     $include_path = array_reverse($include_path);
     $found = array('files' => array(), 'last_mtime' => 0);
     foreach ($include_path as $path) {
         foreach ($accept_language as $lang) {
             $file = $path . 'i18n' . DS . $lang . '.lang';
             if (is_file($file)) {
                 $found['files'][] = $file;
                 $found['last_mtime'] = max($found['last_mtime'], filemtime($file));
             }
         }
     }
     return $found;
 }
開發者ID:xiaodin1,項目名稱:myqee,代碼行數:28,代碼來源:i18n.class.php

示例3: 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::include_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。