24 lines
577 B
PHP
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);
|
|
}
|
|
}
|