江湖家居至尊版程序文件访问运行原理
江湖家居系统使用PHP语言,自己开发的mvc框架, MVC就是 Model(模型) View(视图 ) Controller(控制器) ,url地址访问运行原理为,在浏览器里输入伪静态地址后,程序将自动转换为可直接访问动态地址,所有页面都是由单文件index.php入口,index.php?后面的第一个参数为加载的对象,对象文件全部放在控制器目录内,如 “tenders”表示加载 system\home\controllers\控制器目录下的 tenders.ctl.php对象文件,第二个参数为对象方法,即执行该对象(实例化的类)内的方法(类里面对应的函数),多个参数之间用斜杠"/"分隔。执行的顺序是:/控制器目录/对象/方法。
实际执行文件路径为:/system/home/controllers/参数1.ctl.php/参数2(类中的函数)。
示例一:
招标栏目:http://hf.zx.95zhuang.cn/index.php?tenders
地址访问原理:所有页面都单文件index.php入口,“tenders”参数表示执行 system\home\controllers\控制器目录下的 tenders.ctl.php 对象文件,此对象中的方法(类中的函数) index() 代码如下:
public function index()
{
$access = $this->system->config->get('access');
$this->pagedata['tender_yz'] = $access['verifycode']['tender'];
$this->seo->init('tenders');
$this->tmpl = 'tenders/index.html';
}
分析此对象源代码可知,此控制器最后会加载视图模板目录内的 'tenders/index.html'文件。
-----------------------------------------------------------------------------------------------------------------------------------------------------
示例二:
“本地新闻”栏目:http://www.aj0527.com/index.php?news/items
地址访问原理:所有页面都单文件index.php入口,第一个参数 “news ”表示执行 system\home\controllers\控制器目录下的 news .ctl.php 对象文件,第二个参数 “items” 执行此对象文件(news.ctl.php)中的 “items”方法,即此对象(实例化的类)中items”()函数。
-------------------------------------------------------------------------------------------------------------------------------------------------------
URL格式:
默认URL格式: /article.html, /article-items.html, /article-detail-1-1.html
目录URL格式: /article/,/article/items,/article/detail-1-1.html
注:
CTL是英文ConTroL(控制)的缩写
PHP的MVC框架深入解析
http://www.admin365.cn/thread-41486-1-1.html
页:
[1]