本文整理汇总了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];
}