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


PHP CI_Loader::_ci_init_library方法代碼示例

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


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

示例1: _ci_init_library

 /**
  * Internal CI Library Instantiator
  *
  * @used-by	CI_Loader::_ci_load_stock_library()
  * @used-by	CI_Loader::_ci_load_library()
  *
  * @param	string		$class		Class name
  * @param	string		$prefix		Class name prefix
  * @param	array|null|bool	$config		Optional configuration to pass to the class constructor:
  *						FALSE to skip;
  *						NULL to search in config paths;
  *						array containing configuration data
  * @param	string		$object_name	Optional object name to assign to
  * @return	void
  */
 protected function _ci_init_library($class, $prefix, $config = FALSE, $object_name = NULL)
 {
     // Is there an associated config file for this class? Note: these should always be lowercase
     if ($config === NULL) {
         // Fetch the config paths containing any package paths
         $config_component = $this->_ci_get_component('config');
         if (is_array($config_component->_config_paths)) {
             $_config = array();
             foreach ($config_component->_config_paths as $path) {
                 // We test for both uppercase and lowercase, for servers that
                 // are case-sensitive with regard to file names. Load global first,
                 // override with environment next
                 if (file_exists($path . 'config/' . strtolower($class) . '.php')) {
                     include $path . 'config/' . strtolower($class) . '.php';
                 } elseif (file_exists($path . 'config/' . ucfirst(strtolower($class)) . '.php')) {
                     include $path . 'config/' . ucfirst(strtolower($class)) . '.php';
                 }
                 isset($config) && array_merge($_config, $config);
                 if (file_exists($path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php')) {
                     include $path . 'config/' . ENVIRONMENT . '/' . strtolower($class) . '.php';
                 } elseif (file_exists($path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php')) {
                     include $path . 'config/' . ENVIRONMENT . '/' . ucfirst(strtolower($class)) . '.php';
                 }
                 isset($config) && array_merge($_config, $config);
             }
             // Create a copy of config merged files
             !empty($_config) && ($config = $_config);
         }
     }
     return parent::_ci_init_library($class, $prefix, $config, $object_name);
 }
開發者ID:davidsosavaldes,項目名稱:Codeigniter-Bundle,代碼行數:46,代碼來源:Bundle_Loader.php


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