微擎模块管理的执行路由

参考:http://blog.okbase.net/JO2000/archive/56040.html
参考原文创建时间:2017/3/23 22:51:04

现给出URL: http://xxx.com/web/index.php?c=site&a=entry&eid=6
微擎系统是如何找到具体模块中的对应方法的?下面简单梳理一下:

web目录下的index.php 包含了

require '../framework/bootstrap.inc.php';

在bootstrap.inc.php的最后读取controller,action,do

$controller = $_GPC['c'];
$action = $_GPC['a'];
$do = $_GPC['do'];

index.php继续往下走,require _forward(controller,action);
function _forward(c,a) {
file = IA_ROOT . '/web/source/' .c . '/' . a . '.ctrl.php'; returnfile;
}

包含了 /web/source/site/entry.ctrl.php

在entry.ctrl.php里:
从ims_modules_bindings表里读取eid=6的记录到$entry,然后根据记录加载模块,

site = WeUtility::createModuleSite(entry['module']);
define('IN_MODULE', entry['module']); ...method = 'doWeb' . ucfirst(entry['do']); exit(site->$method());

例如$entry['do']是stores,那实际调用的方法是模块目录下site.php里的doWebStores

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 执行 http://xxx.com/web/index.php?c=site&a=entry&eid=6 系统是如...
    destiny96阅读 4,468评论 0 4
  • Getting Started Use the Current Stable Version (7.1) Buil...
    Leonzai阅读 1,986评论 0 3
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,107评论 19 139
  • 湖边的枯枝上,立着一只老鱼狗。老鱼狗豆粒般的眼睛一动不动的盯着湖面,似在专注湖面的动静,又像沉醉在记忆之中。 ...
    了然未了阅读 487评论 0 0
  • 2016.12.07 外传。药用技能结束后,有点小激动,刹不住了,于是就让葛洪莉帮我回信息,我不知道葛洪莉发的那些...
    4月的小猴子阅读 235评论 0 0