Compare commits
3 Commits
08c36dd0b5
...
f778c1f4a2
Author | SHA1 | Date |
---|---|---|
William | f778c1f4a2 | |
William | 028908053a | |
William | a640b11b66 |
|
@ -12,13 +12,14 @@ abstract class Route {
|
||||||
array_map(strtoupper(...), explode('|', $methods))
|
array_map(strtoupper(...), explode('|', $methods))
|
||||||
)) return;
|
)) return;
|
||||||
|
|
||||||
static $request_path_parts;
|
static $cache;
|
||||||
if (!isset($request_path_parts)) {
|
if (!isset($cache)) {
|
||||||
$request_path_parts = explode('/', urldecode(
|
$cache = explode('/', urldecode(
|
||||||
strtok($_SERVER['REQUEST_URI'], '?')
|
strtok($_SERVER['REQUEST_URI'], '?')
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
$request_path_parts = $cache;
|
||||||
|
|
||||||
$path_parts = explode('/', $path);
|
$path_parts = explode('/', $path);
|
||||||
$callback_args = [];
|
$callback_args = [];
|
||||||
for ($i=0; $i < count($path_parts); $i++) {
|
for ($i=0; $i < count($path_parts); $i++) {
|
||||||
|
@ -35,7 +36,7 @@ abstract class Route {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!empty($request_path_parts[$i])) {
|
if (!empty($request_path_parts[$i])) {
|
||||||
$callback_args[] = $request_path_parts[$i];
|
array_push($callback_args, $request_path_parts[$i]);
|
||||||
}
|
}
|
||||||
$request_path_parts[$i] = $path_parts[$i];
|
$request_path_parts[$i] = $path_parts[$i];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue