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))
|
||||
)) return;
|
||||
|
||||
static $request_path_parts;
|
||||
if (!isset($request_path_parts)) {
|
||||
$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++) {
|
||||
|
@ -35,7 +36,7 @@ abstract class Route {
|
|||
return;
|
||||
}
|
||||
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];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue