本文整理匯總了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);
}