Add type "boolean" in "arg" base.php function
This commit is contained in:
parent
d5a961ce64
commit
f306f8dd4d
5
base.php
5
base.php
|
@ -94,6 +94,9 @@ function arg($arg, $default=null, $validator=null) {
|
||||||
} else if (strpos($arg,'d:') === 0) {
|
} else if (strpos($arg,'d:') === 0) {
|
||||||
$type = 'double';
|
$type = 'double';
|
||||||
$arg = substr($arg, 2);
|
$arg = substr($arg, 2);
|
||||||
|
} else if (strpos($arg, 'b:') === 0) {
|
||||||
|
$type = 'boolean';
|
||||||
|
$arg = substr($arg, 2);
|
||||||
} else if (strpos($arg,'b64:') === 0) {
|
} else if (strpos($arg,'b64:') === 0) {
|
||||||
$type = 'base64';
|
$type = 'base64';
|
||||||
$arg = substr($arg, 4);
|
$arg = substr($arg, 4);
|
||||||
|
@ -124,6 +127,8 @@ function arg($arg, $default=null, $validator=null) {
|
||||||
$value = intval($value);
|
$value = intval($value);
|
||||||
else if ($type === 'double')
|
else if ($type === 'double')
|
||||||
$value = doubleval($value);
|
$value = doubleval($value);
|
||||||
|
else if ($type === 'boolean')
|
||||||
|
$value = in_array($value,[1,"1","yes","true"]) ? true : false;
|
||||||
else if ($type === 'base64')
|
else if ($type === 'base64')
|
||||||
$value = base64_decode($value);
|
$value = base64_decode($value);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue