Support the use of global (or other) variables in "arg" method
This commit is contained in:
parent
5022d34c28
commit
26871ff539
5
base.php
5
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,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…
Reference in New Issue