Added support for both server vars
This commit is contained in:
parent
c69ea79785
commit
ec99235500
9
app.sh
Normal file → Executable file
9
app.sh
Normal file → Executable file
@ -14,4 +14,11 @@ fi
|
||||
# Handle multiple simultaneous requests in Linux only:
|
||||
export PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
php -S 0.0.0.0:$PORT index.php --enable-mbstring
|
||||
FILTER=".*"
|
||||
|
||||
if [[ "$@" =~ "--quiet" ]]
|
||||
then
|
||||
FILTER="INFO"
|
||||
fi
|
||||
|
||||
php -S 0.0.0.0:$PORT index.php --enable-mbstring 2>&1 | grep -E "${FILTER}"
|
||||
|
@ -15,6 +15,19 @@
|
||||
if ($strParam == null)
|
||||
$strParam = "";
|
||||
|
||||
error_log("INFO: " . json_encode($_SERVER, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
|
||||
foreach (["REQUEST_URI", "PATH_INFO"] as $k)
|
||||
if (strlen($strParam) < 1)
|
||||
{
|
||||
if (is_array($_SERVER))
|
||||
if (array_key_exists($k, $_SERVER))
|
||||
if (strlen($_SERVER[$k]) > 0)
|
||||
$strParam = $_SERVER[$k];
|
||||
}
|
||||
|
||||
$strParam = preg_replace("/\?.*$/", "", $strParam);
|
||||
|
||||
// REQUEST_URI method:
|
||||
if (strlen($strParam) < 1)
|
||||
{
|
||||
@ -24,6 +37,8 @@
|
||||
$strParam = $_SERVER["PATH_INFO"];
|
||||
}
|
||||
|
||||
//error_log(json_encode($_SERVER, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
|
||||
$strPath = $strParam;
|
||||
$strPath = preg_replace("/^\//", "", $strPath);
|
||||
$strPath = preg_replace("/\/$/", "", $strPath);
|
||||
@ -202,9 +217,18 @@
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function log()
|
||||
{
|
||||
//$strPath = $_SERVER["PATH_INFO"];
|
||||
|
||||
error_log("[{$strPath}] INFO: " . implode(" ", func_get_args()));
|
||||
}
|
||||
}
|
||||
|
||||
// Call this no matter what to understand the request:
|
||||
Request::process();
|
||||
Request::processExtra();
|
||||
|
||||
Request::log("");
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user