This commit is contained in:
William 2023-01-27 13:09:02 +00:00
parent ecd318498f
commit 3dfee69beb

View File

@ -12,10 +12,16 @@ abstract class Route {
array_map(strtoupper(...), explode('|', $methods)) array_map(strtoupper(...), explode('|', $methods))
)) return; )) return;
$callback_args = []; static $request_path_parts;
$request_path = urldecode($_SERVER['REQUEST_URI']); if (!isset($request_path_parts)) {
$request_path_parts = explode('/', urldecode(
strtok($_SERVER['REQUEST_URI'], '?')
)
);
}
$path_parts = explode('/', $path); $path_parts = explode('/', $path);
$request_path_parts = explode('/', $request_path); $callback_args = [];
for ($i=0; $i < count($path_parts); $i++) { for ($i=0; $i < count($path_parts); $i++) {
if (empty($path_parts[$i])) { if (empty($path_parts[$i])) {
continue; continue;