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


PHP Finder::get_config_file方法代碼示例

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


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

示例1: Lib

/**
 * Loads a library and returns it's instance.
 *
 * @param string	The library name/path
 * @param array		The configuration
 * @return object
 */
function Lib($library, $config = null)
{
    static $libraries = array();
    if ($library === false) {
        // init default loaded classes here
        $classes = array('config' => 'config', 'input' => 'input', 'benchmark' => 'benchmark', 'uri' => 'uri', 'output' => 'output', 'lang' => 'lang', 'router' => 'router');
        $CI =& get_instance();
        foreach ($classes as $var) {
            $libraries[$var] =& $CI->{$var};
        }
        $libraries['load'] =& $CI->load;
        $libraries['loader'] =& $CI->load;
        return null;
    }
    $library = strtolower($library);
    // already loaded?
    if (isset($libraries[$library])) {
        return $libraries[$library];
    }
    if (!($res = Finder::load_file($library, 'libraries'))) {
        log_message('error', "Unable to load the requested class file: libraries/" . $library);
        show_error("Unable to load the requested class file: libraries/" . $library);
    }
    if ($config === null) {
        foreach (Finder::get_config_file($library) as $c) {
            include_once $c;
        }
    }
    if (($p = strrpos($library, '/')) !== false) {
        $library = substr($library, $p + 1);
    }
    if ($res === 'SUBCLASS') {
        $name = Finder::$subclass_prefix . $library;
    } else {
        if (class_exists('CI_' . $library)) {
            $name = 'CI_' . $library;
        } else {
            $name = $library;
        }
    }
    // Is the class name valid?
    if (!class_exists($name)) {
        log_message('error', "Non-existent class: " . $name);
        show_error("Non-existent class: " . $name);
    }
    if ($config !== null) {
        $libraries[$library] = new $name($config);
    } else {
        $libraries[$library] = new $name();
    }
    return $libraries[$library];
}
開發者ID:BGCX261,項目名稱:zillatek-project-svn-to-git,代碼行數:59,代碼來源:accessors.php


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