src/Leevel/Http/Bag.php
protected function filterValue($value, $defaults, array $filters, array $options = [])
    {
        foreach ($filters as $item) {
            if (is_string($item) && false !== strpos($item, '=')) {
                $value = $this->filterValueWithFunc($value, $item);
            } elseif (is_callable($item)) {
                $value = $this->filterValueWithCallable($value, $item);
            } elseif (is_scalar($value) && !empty($item)) {
                $value = $this->filterValueWithFilterVar($value, $item, $options);

                if (false === $value) {
                    $value = $defaults;

                    break;
                }
            }
        }

        return $value;
    }
protected function filterValue($value, $defaults, array $filters, array $options = [])
    {
        foreach ($filters as $item) {
            if (is_string($item) && false !== strpos($item, '=')) {
                $value = $this->filterValueWithFunc($value, $item);
            } elseif (is_callable($item)) {
                $value = $this->filterValueWithCallable($value, $item);
            } elseif (is_scalar($value) && !empty($item)) {
                $value = $this->filterValueWithFilterVar($value, $item, $options);

                if (false === $value) {
                    $value = $defaults;

                    break;
                }
            }
        }

        return $value;
    }
过滤值

@param mixed $value
@param mixed $defaults
@param array $filters
@param array $options

@return mixed