http://wq.90ckm.com/app/index.php?i=2&c=entry&eid=15
1 2 3 4 | i:是公眾號的站內id c=entry :應用入口 eid:用戶(hù)安裝后的應用id |
數據表:
ims_modules 模塊表,一個(gè)模塊應該有一個(gè)記錄
ims_modules_bindings ,模塊后臺菜單表記錄,一個(gè)模塊有N多記錄(eid=15)
ims_uni_account_modules,公眾號應該有的權限及配置信息,如果沒(méi)有可以忽略
前臺原始(使用app):
http://xxxx.com/app/./index.php?i=2&c=entry&eid=15
MVC形式
http://xxxx.com/app/index.php?i=2&c=entry&do=index&m=two_eggs
do=index
前臺方法====>doMobileXXX
=============>doMobileIndex方法
后臺原始(使用web)
http://xxxx.com/web/index.php?c=site&a=entry&eid=17&version_id=0
MVC形式
http://xxxx.com/web/index.php?i2&c=site&do=Confs&m=two_eggs
do=Confs==> site.php
后臺方法====>doWebXXX
=============>doWebConfs方法
site.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <?php /** * wmc_happynewyear模塊微站定義 * * @author 287851074 * @url */ defined('IN_IA') or exit('Access Denied'); class wmc_happynewyearModuleSite extends WeModuleSite { // 前臺方法 public function doMobileIndex() { //這個(gè)操作被定義用來(lái)呈現 功能封面 } // 后臺方法 public function doWebConfs() { //這個(gè)操作被定義用來(lái)呈現 管理中心導航菜單 } // 后臺方法 public function doWebUsers() { //這個(gè)操作被定義用來(lái)呈現 管理中心導航菜單 } } |
參考:
執行 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(chǎn)’];
$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
聯(lián)系客服