`
阿尔萨斯
  • 浏览: 4191779 次
社区版块
存档分类
最新评论

一分钟让你知道什么叫MVC分离及模板引擎原理——权当搞笑

 
阅读更多

一分钟让你知道什么叫MVC分离及模板引擎原理——权当搞笑


<?php
//model/view.php(Model)
classView{
public
$var;
publicfunction
display($tplfile){
include_once
$tplfile;
}
}



<?php
//index.php(Controller)
include_once'model/view.php';
$view=newView();
$view->var=array('hello','world');
$view->display('view/out.php');


<?php//view/out.php(View)?>
<h1>MVCandTemplateEngine</h1>
<p>
<?phpforeach($this->varas$v):?>
<?php
echo$v;?><br/>
<?phpendforeach;?>
</p>
<address>Author:Leo</address>


MVC and TemplateEngine
hello
world

Author: Leo
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics