執行 http://xxx.com/web/index.php?c=site&a=entry&eid=6 系統是如何找到具體模塊中的對應方法的?下面簡(jiǎn)單梳理一下:
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';
return $file;
}
包含了 /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,那實(shí)際調用的方法是模塊目錄下site.php里的doWebStores
文章來(lái)源:http://jinhuajuanke.cn
聯(lián)系客服