-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
32 lines (27 loc) · 933 Bytes
/
index.php
File metadata and controls
32 lines (27 loc) · 933 Bytes
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
require_once(__dir__ . "/global.php");
$pathUrl = (isset($_GET["path"])) ? "/" . $_GET["path"] : "/"; # Você pode obter $_GET["path"] através da configuração do .htacess ou web.config
$Router::register([
"file" => "/index.php", # O nome do arquivo para obter o contéudo
"route" => [
"",
"/",
"/index",
"/index/([0-9]+)" # Se conter expressão regular todas irão retornar como $_GET em ordem numérica. Ex: $_GET["arg_0"]
]
]);
$Router::register([
"file" => "/another.php",
"route" => [
"/another"
]
]);
$Router::register([
"file" => "/regex.php",
"route" => [
"/regex",
"/regex/([0-9]+)"
]
]);
$Router::get($pathUrl); # Verifica as rotas registradas mediante ao URL obtido, caso exista vai retornar o contéudo da mesma.
?>