-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
32 lines (26 loc) · 932 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require "Controllers/IndexController.php";
require "View.php";
require "Router.php";
/**
* EN: You should learn about composer autoloader
* PL: Powinieneś zapoznać się z composer autoloader aby nie wpisywać require dla klas
*/
use Simpleproject\Controllers\IndexController;
use Simpleproject\Router;
use Simpleproject\View;
/**
* EN: Just for example i set $_SESSION
* PL: Dla przykładu ustawiam $_SESSION
*/
$_SESSION["auth"] = true;
$_SESSION["user"] = "admin";
$router = new Router(new View());
$router->addRoute("/", [IndexController::class, "indexAction"]);
/**
* EN: If you run for example from simple-php-project directory then your baseUri is /simple-php-project
* PL: Jeśli uruchamiasz stronę z foldderu simple-php-project to wtedy twój baseUri to /simple-php-project
*/
echo $router->handle($_SERVER['REQUEST_URI'], "/simple-php-project");