This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/app/core/Controller.php

20 lines
491 B
PHP
Raw Normal View History

2022-01-15 10:26:02 +00:00
<?php
class Controller
{
public function model(string $model): object
{
// Require model file
require __DIR__ . '/../model/' . $model . '.php';
// Instantiate model
return new $model();
}
public function view(string $view, array $data = []): void
{
// Import variables into the current symbol table from an array
extract($data);
// Require view file
require __DIR__ . '/../view/' . $view . '.php';
}
}