loader.class.php 虽然下面module()方法还不太明白,但是大概知道 其他文件加载这个文件之后会
用load()->("文件名前缀"),加载framework下文件
cache['func'][$name])) {
return true;//检测这个数组值是否存在
}
$file = IA_ROOT . '/framework/function/' . $name . '.func.php';
//file_exists检查文件是否存在 返回布尔值
if (file_exists($file)) {
include $file;
$this->cache['func'][$name] = true;
return true;
} else {
//报出一个错误
trigger_error('Invalid Helper Function /framework/function/' . $name . '.func.php', E_USER_ERROR);
//疑问 E_USER_ERROR 是在哪定义的变量
return false;
}
}
//下面几个函数和上面func类似是用load()->("文件名前缀")的方式加载framework下文件的方式
function model($name) {
global $_W;
if (isset($this->cache['model'][$name])) {
return true;
}
$file = IA_ROOT . '/framework/model/' . $name . '.mod.php';
if (file_exists($file)) {
include $file;
$this->cache['model'][$name] = true;
return true;
} else {
trigger_error('Invalid Model /framework/model/' . $name . '.mod.php', E_USER_ERROR);
return false;
}
}
function classs($name) {
global $_W;
if (isset($this->cache['class'][$name])) {
return true;
}
$file = IA_ROOT . '/framework/class/' . $name . '.class.php';
if (file_exists($file)) {
include $file;
$this->cache['class'][$name] = true;
return true;
} else {
trigger_error('Invalid Class /framework/class/' . $name . '.class.php', E_USER_ERROR);
return false;
}
}
function web($name) {
global $_W;
if (isset($this->cache['web'][$name])) {
return true;
}
$file = IA_ROOT . '/web/common/' . $name . '.func.php';
if (file_exists($file)) {
include $file;
$this->cache['web'][$name] = true;
return true;
} else {
trigger_error('Invalid Web Helper /web/common/' . $name . '.func.php', E_USER_ERROR);
return false;
}
}
function app($name) {
global $_W;
if (isset($this->cache['app'][$name])) {
return true;
}
$file = IA_ROOT . '/app/common/' . $name . '.func.php';
if (file_exists($file)) {
include $file;
$this->cache['app'][$name] = true;
return true;
} else {
trigger_error('Invalid App Function /app/common/' . $name . '.func.php', E_USER_ERROR);
return false;
}
}
function module($module, $file) {
if (isset($this->cache['encrypte'][$name])) {
return true;
}
//file_get_contents() 把整个文件内的所有读入一个字符串中。
//这里的$name哪来的
if (strexists(file_get_contents($name), 'cache['encrypte'][$name] = true;
require $name;
} else {
//cache_load????
$key = cache_load('module:cloud:key:1');
$vars = cache_load('module:cloud:vars:1');
if (empty($vars)) {
trigger_error('Module is missing critical files , please reinstall');
}
//<<