Blogger Information
Blog 77
fans 0
comment 0
visits 55252
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
简单理解MVC和自动加载_1015
Jet的博客
Original
724 people have browsed it

MVC理解:

M:model模型,对数据库管理、操作;

V:view试图,前端视图格式化;

C:controller控制器,请求派发器,用户点击事件进行处理

自动加载:

其实就是自动加载函数

index.php文件:

<?php
<!--加载当前页面模板-->
<?php auto_load_tpl($tplName);  ?>

controller文件:

<?php
function auto_load_tpl($tplName)
{
    global $list;    //列表
    global $page;    //分页

    //自动加载模板
    include './view/tpl/'.$tplName.'.php';
}

然后对应自动加载相关view.php文件







Correction status:qualified

Teacher's comments:再多写点注释会更好
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post