->load(1) php,解读微擎 之load()函数 ----loader.class.php

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');

}

//<<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值