應用目錄
應用存放在/addons目錄下
應用下的模板存放在/template目錄下,其中前端存放於/template/mobile目錄,后端直接放在/template/ 下;
URL:
前台:http://www.aa.com/app/index.php?i=1&c=entry&eid=2 后台:http://www.aa.com/web/index.php?c=site&a=entry&eid=3&version_id=0 MVC形式的URL: 前台:http://www.aa.com/app/index.php?i=1&c=entry&do=index&m=edu_2018 后台:http://www.aa.com/web/index.php?c=site&a=entry&do=company&m=edu_2018
/app/:表示為前台頁面
/web/:表示為后台頁面
i=1:表示平台中公眾號位置,第一個公眾號
c=entry:前端c表示入口,默認entry
c=site:后端c表示site.php入口文件
a=entry:后端a表示入口,默認entry
eid=2:應用安裝到數據庫后多個菜單的id標識
do:類方法名稱
m:表示應用模塊名稱
創建URL
$this->createMobileUrl('index'); $this->createWebUrl('company');
類:
前端名稱必須以doMobile開頭:function doMobileIndex() {…}
后端名稱必須以doWeb開頭:function doWebHt() {…}
全局變量
$_W是系統中最為重要的全局變量 用法: $_W[‘siteroot’] $_GPC全局請求變量, 獲取 $_GET, $_POST, $_COOKIES 中的變量 用法:$_GPC[‘eid’]
數據庫
增加: pdo_insert($tablename, $data = array(), $replace = false); int | boolean 刪除: pdo_delete($tablename, $condition = array(), $glue = 'AND') int | boolean 更新: pdo_update($tablename, $data = array(), $condition, $glue = 'AND') array | boolean 查詢: pdo_get($tablename, $condition = array(), $fields = array()); array | boolean 查詢所有:pdo_getall($tablename, $condition = array(), $fields = array(), $keyfield = ''); array | boolean
模板:
類方法中的變量、數組等不需要引入或賦予前端模板,可以直接調用
public function doWebOrder() { global $_GPC,$_W; $name='1-8課'; $array=['哥','姐','弟','妹']; include $this->template('index'); } 輸出變量:{$name}<br/> 循環數組: <ul> <!-- 循環數組$index指針不是必須 --> {loop $array $index $item} {php $num=$index+1} <!-- PHP語句 --> <li> {$index}-{$num}- <!-- if else判斷 --> {if $item=='哥' || $item=='弟'} {$item}-男 {else} {$item}-女 {/if} </li> {/loop} </ul> 跳轉:<a href="{php echo $this->createMobileUrl('index')}">點擊</a><br/> 引入模板: {template 'footer'}