Mini optimization

This commit is contained in:
William 2023-01-30 22:18:57 +01:00
parent 028908053a
commit f778c1f4a2
1 changed files with 8 additions and 3 deletions

View File

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