Think/Template/TagLib/Cx.php
public function _range(array $tag = [], $content = '', $type = 'in')
    {
        $name = $tag['name'];
        $value = $tag['value'];
        $varArray = explode('|', $name);
        $name = array_shift($varArray);
        $name = $this->autoBuildVar($name);
        if (count($varArray) > 0) {
            $name = $this->tpl->parseVarFunction($name, $varArray);
        }

        $type = isset($tag['type']) ? $tag['type'] : $type;

        if ('$' == substr($value, 0, 1)) {
            $value = $this->autoBuildVar(substr($value, 1));
            $str = 'is_array('.$value.')?'.$value.':explode(\',\','.$value.')';
        } else {
            $value = '"'.$value.'"';
            $str = 'explode(\',\','.$value.')';
        }
        if ($type == 'between') {
            $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'>= $_RANGE_VAR_[0] && '.$name.'<= $_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>';
        } elseif ($type == 'notbetween') {
            $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'<$_RANGE_VAR_[0] || '.$name.'>$_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>';
        } else {
            $fun = ($type == 'in') ? 'in_array' : '!in_array';
            $parseStr = '<?php if('.$fun.'(('.$name.'), '.$str.')): ?>'.$content.'<?php endif; ?>';
        }

        return $parseStr;
    }
public function _range(array $tag = [], $content = '', $type = 'in')
    {
        $name = $tag['name'];
        $value = $tag['value'];
        $varArray = explode('|', $name);
        $name = array_shift($varArray);
        $name = $this->autoBuildVar($name);
        if (count($varArray) > 0) {
            $name = $this->tpl->parseVarFunction($name, $varArray);
        }

        $type = isset($tag['type']) ? $tag['type'] : $type;

        if ('$' == substr($value, 0, 1)) {
            $value = $this->autoBuildVar(substr($value, 1));
            $str = 'is_array('.$value.')?'.$value.':explode(\',\','.$value.')';
        } else {
            $value = '"'.$value.'"';
            $str = 'explode(\',\','.$value.')';
        }
        if ($type == 'between') {
            $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'>= $_RANGE_VAR_[0] && '.$name.'<= $_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>';
        } elseif ($type == 'notbetween') {
            $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'<$_RANGE_VAR_[0] || '.$name.'>$_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>';
        } else {
            $fun = ($type == 'in') ? 'in_array' : '!in_array';
            $parseStr = '<?php if('.$fun.'(('.$name.'), '.$str.')): ?>'.$content.'<?php endif; ?>';
        }

        return $parseStr;
    }
range标签解析
如果某个变量存在于某个范围 则输出内容 type= in 表示在范围内 否则表示在范围外
格式： <range name="var|function"  value="val" type='in|notin' >content</range>
example: <range name="a"  value="1,2,3" type='in' >content</range>


@param array $tag 标签属性
@param string $content 标签内容
@param string $type 比较类型

@return string