Added support for getting entire list of "arguments" for root index.php files

This commit is contained in:
Conner Harkness 2025-06-21 16:42:48 -06:00
parent 3857298a88
commit cb309511c3
2 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,7 @@
public static $strScriptPath;
public static $strResourcePath;
public static $varArgs;
public static $varPathParts;
public static function process()
{
@ -27,6 +28,9 @@
$strPath = preg_replace("/^\//", "", $strPath);
$strPath = preg_replace("/\/$/", "", $strPath);
// Support for index arguments:
Request::$varPathParts = explode("/", $strPath);
// /test/action/a/b/c
$fncIsFile = function($strScriptPath)
@ -73,6 +77,8 @@
array_shift($varArgs);
error_log($strParam);
Request::$varArgs = $varArgs;
Request::$strResourcePath = $strPath;
}
@ -87,6 +93,11 @@
return Request::$varArgs;
}
public static function getPathParts()
{
return Request::$varPathParts;
}
// Safely returns a request argument by its index or null if it doesn't exist (without error)
public static function getArg($intIndex)
{

View File

@ -1,3 +1,3 @@
#!/bin/bash
php -S 0.0.0.0:8080 index.php
php -S 0.0.0.0:8080 index.php --enable-mbstring