Controller
<?php
class testController{
//控制器的作用是調用模型並調用視圖,將模型產生的數據傳遞給視圖,並讓相關視圖去顯示
function show(){
/* $testModel = new testModel();
$data = $testModel->get();
$testView = new testView();
$testView->display($data);*/
$testModel = M('test');
$data = $testModel->get();
$testView = V('test');
$testView->display($data);
}
}
?>
Model
<?php
class testModel{
function get(){
return "hello world";
}
}
?>
view
<?php
class testView{
function display($data){
echo $data;
}
}
?>
function