本文整理汇总了PHP中CI_Loader::_ci_load_class方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Loader::_ci_load_class方法的具体用法?PHP CI_Loader::_ci_load_class怎么用?PHP CI_Loader::_ci_load_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Loader
的用法示例。
在下文中一共展示了CI_Loader::_ci_load_class方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: library
/** Load a module library **/
public function library($library, $params = NULL, $object_name = NULL)
{
if (is_array($library)) {
return $this->libraries($library);
}
$class = strtolower(end(explode('/', $library)));
if (isset($this->_ci_classes[$class]) and $_alias = $this->_ci_classes[$class]) {
return CI::$APP->{$_alias};
}
$_alias = $object_name or $_alias = $class;
list($path, $_library) = Modules::find($library, $this->_module, 'libraries/');
/* load library config file as params */
if ($params == NULL) {
list($path2, $file) = Modules::find($_alias, $this->_module, 'config/');
$path2 and $params = Modules::load_file($file, $path2, 'config');
}
if ($path === FALSE) {
parent::_ci_load_class($library, $params, $object_name);
$_alias = $this->_ci_classes[$class];
} else {
Modules::load_file($_library, $path);
$library = ucfirst($_library);
CI::$APP->{$_alias} = new $library($params);
$this->_ci_classes[$class] = $_alias;
}
$this->_ci_assign_to_models();
return CI::$APP->{$_alias};
}
示例2: trim
/**
* Load class
*
* This function loads the requested class.
*
* @access private
* @param string the item that is being loaded
* @param mixed any additional parameters
* @return void
*/
function _my_load_class($class, $params = NULL)
{
$module = $this->_module_lookup($class);
// check the hash of the file
if (array_key_exists('md5', $module)) {
$md5 = trim($module['md5']);
if (!$this->_my_check_md5($class, $md5)) {
return FALSE;
}
}
// load all requred modules
if (array_key_exists('required', $module)) {
$requires = split(',', $module['required']);
foreach ($requires as $require) {
if (trim($require) == '') {
continue;
}
if ($this->_my_load_class(trim($require), $params) === false) {
return false;
}
}
}
parent::_ci_load_class($class, $params);
}