简单的PHP框架,实现antoload,viewEngine,
有兴趣学写MVC框架的可以看看这篇文章: http://my.oschina.net/u/131802/blog/82016
这个很适合初学者对框架的认识
index.php 入口文件
<?php
function __autoload($class){
include $class.'.php';
}
$t = new tController();
$t->index();
Controller.php 核心控制器
<?php
class Controller {
function render($temple, $arr){
extract($arr);
ob_start();
include $temple;
$content = ob_get_contents();
ob_end_clean();
echo $content;
}
}
 tController.php 普通控制器
<?php
class tController extends Controller{
function index(){
$this->render('t.php', array('name'=>'aaaaaaaaaaa'));
}
}
t.php 视图文件
<html>
<header>
<title></title>
</header>
<body>
<?php echo @$name; ?>
<form method="post" action="">
用户名:<input name="username" type="text" value=""><br>
密码: <input name="password" type="password"><br>
<input name="submit" type="submit" value="提交">
</form>
</body>
</html>
