Micro engine development - to explain the basis

Application Directory

Applications stored in / addons directory
under the application stored in the template / template directory, which is stored in the front end / template / Mobile directory, directly on the rear / template / lower;

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 /: expressed as a front page
/ web /: expressed as a background page
i = 1: indicates the position of the platform public number, the first public number
c = entry: c represents a distal inlet, a default entry
c = Site: c backend site.php entry file represents
a = entry: a represents a rear inlet, the default entry
EID = 2: application of the plurality of menus to install the database id of identification
do: class method name
m: represents the name of application modules

Create a URL

$this->createMobileUrl('index');
$this->createWebUrl('company');

class:

Distal name must begin doMobile: function doMobileIndex () {... }
backend name must begin doWeb: function doWebHt () {... }

Global Variables

$_W是系统中最为重要的全局变量
用法: $_W[‘siteroot’]
$_GPC全局请求变量, 获取 $_GET, $_POST, $_COOKIES 中的变量 用法:$_GPC[‘eid’] 

database

增加: 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 

template:

The method of class variables, arrays, and so the need to introduce the distal end to impart a template or can be called directly

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'}



Guess you like

Origin www.cnblogs.com/xinhan/p/11205329.html