Creating my First PHP Framework : Day 4
After knowing which controller to load with App.php , we need to know what the view corresponding, or simply create a functions to load the view in Controller.php in this file we find a function called view , it has 3 parameters - $view : the view file name - $data = [] : array of a view variables ,if we want send variables to the view - $template = " default " : The view layout it loads by default , default.php exemple : $this -> view( ' pages/home ' , $data = [ ' name ' => $name ]); the second function model is just requiring the model for the controller require_once " ../app/models/ " . $model . " .php " ; and getting instant of it return new $model (); Tip : ob_start is more like to save the view file content inside a variable