I'm stupid

This commit is contained in:
William 2022-12-29 03:39:50 +00:00
parent df60d482f7
commit c37a313924
1 changed files with 4 additions and 4 deletions

View File

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