igfs/index.php
2024-07-03 15:15:59 +03:00

24 lines
659 B
PHP

<?php
require_once "vendor/autoload.php";
require 'bootstrap.php';
use app\controllers\MainController;
use Controllers\Users;
use Controllers\Questions;
use Controllers\Answers;
use Controllers\Posts;
use Phroute\Phroute\RouteCollector;
$router = new RouteCollector();
$router->get('/', [MainController::class, 'actionIndex']);
$router->get('/example', [MainController::class, 'actionExample']);
$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
// Print out the value returned from the dispatched function
echo $response;