Support the use of global (or other) variables in "arg" method

main
Bofh 5 months ago
parent 5022d34c28
commit 26871ff539

@ -77,7 +77,7 @@ function no_http() {
function arg($arg, $default=null, $validator=null) {
$arg = trim($arg);
$type = 'string';
$type = null;
$require = false;
if (strpos($arg,'*') === 0) {
@ -116,7 +116,8 @@ function arg($arg, $default=null, $validator=null) {
if ($value === null)
return !$require ? $default : apiresult(['error' => '<'.$arg.'> parameter must be specified'], 400);
$value = trim($value);
if (gettype($value) === 'string')
$value = trim($value);
if ($type === 'string')
$value = strval($value);
else if ($type === 'integer')

Loading…
Cancel
Save