Support the use of global (or other) variables in "arg" method
This commit is contained in:
parent
5022d34c28
commit
26871ff539
3
base.php
3
base.php
|
@ -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,6 +116,7 @@ function arg($arg, $default=null, $validator=null) {
|
|||
if ($value === null)
|
||||
return !$require ? $default : apiresult(['error' => '<'.$arg.'> parameter must be specified'], 400);
|
||||
|
||||
if (gettype($value) === 'string')
|
||||
$value = trim($value);
|
||||
if ($type === 'string')
|
||||
$value = strval($value);
|
||||
|
|
Loading…
Reference in New Issue