I'm stupid

This commit is contained in:
William 2022-12-29 03:39:50 +00:00
parent df60d482f7
commit c37a313924

View File

@ -17,13 +17,13 @@ abstract class Route
)) return; )) return;
// check if the route matches and add parameters if any // check if the route matches and add parameters if any
// TODO: this is just really messy man wtf $request_path = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']);
if (!isset($_SERVER['PATH_INFO'])) { if ($request_path === '') {
$_SERVER['PATH_INFO'] = '/'; $request_path = '/';
} }
$args = []; $args = [];
$path_parts = explode('/', $path); $path_parts = explode('/', $path);
$request_path_parts = explode('/', $_SERVER['PATH_INFO']); $request_path_parts = explode('/', $request_path);
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;