0

I'm new to oop and MVC and I'm trying to test the flow between my index, controller, and model files. All of the test functions work except for 'check status'. What's the problem? The function is highlighted in BOLD. (INDEX)

$Controller = new Controller;
$Controller->ShowRegisterLogin();

?> (CONTROLLER)

Class Controller {

function ShowRegisterLogin() {
    echo 'ShowRegisterLogin Function works';
    $Model = new Model;
    $Model->TestModel();
    **$Model->checkStatus();**      
    }

}

?> (MODEL)

class Model {

    Var $Status = 'return works';

    function TestModel() {
        echo 'Test Model Works';
    }
    **function checkStatus() {
        return $this->Status;
    }**

}

?>

4

1 回答 1

1

You need to echo the value if you want to see it

echo $Model->checkStatus();

Otherwise, nothing gets done with the return value and it disappears.

于 2012-09-17T02:44:28.187 回答