vwlsupport/core/App.php
kknobloch b294ceeec8
2025-04-21 21:34:26 +02:00

24 lines
577 B
PHP

<?php
class App {
protected $controller = 'MainController';
protected $method = 'home';
protected $params = [];
public function __construct() {
if (isset($_GET['page'])) {
$this->method = $_GET['page'];
}
require_once '../src/controller/' . $this->controller . '.php';
$this->controller = new $this->controller;
if (!method_exists($this->controller, $this->method)) {
$this->method = 'home';
}
call_user_func_array([$this->controller, $this->method], $this->params);
}
}