public function init() { if (isset($_SERVER['REQUEST_METHOD'])) { $router = new Router(); $this->setArrayOfProperties($router->reqPopertiesByUrl()); if (isset($_POST)) { $this->post = $_POST; } $this->setProperty('URL', $_SERVER['REQUEST_URI']); return; } foreach ($_SERVER['argv'] as $arg) { if (strpos($arg, '=')) { list($key, $val) = explode('=', $arg); $this->setProperty($key, $val); } } }
<?php use app\library\Router; error_reporting(E_ALL); require_once "vendor/autoload.php"; $router = new Router($_GET); $controller = $router->CreateController(); $controller->executeAction();