MVC模型简单案例

来源:互联网 发布:php 财务系统 编辑:程序博客网 时间:2024/06/03 10:32

test.php

<?phprequire_once 'testModel.class.php';require_once 'testView.class.php';require_once 'testController.class.php';$testContoller = new testController();$testContoller->show();?>

testModel.class.php

<?phpclass testModel{    function get(){        return "hello World!!!";    }}?>

testView.class.php

<?phpclass testView{    function display($data){        echo $data;    }}?>

testController.class.php

<?phpclass testController{    function show(){        $testModel = new testModel();        $data = $testModel -> get();        $testView = new testView();        $testView -> display($data);    }}?>
0 0
原创粉丝点击