Think/Template/TagLib/Cx.php
public function _case(array $tag = [], $content = '')
    {
        $value = $tag['value'];
        if ('$' == substr($value, 0, 1)) {
            $varArray = explode('|', $value);
            $value = array_shift($varArray);
            $value = $this->autoBuildVar(substr($value, 1));
            if (count($varArray) > 0) {
                $value = $this->tpl->parseVarFunction($value, $varArray);
            }
            $value = 'case '.$value.': ';
        } elseif (strpos($value, '|')) {
            $values = explode('|', $value);
            $value = '';
            foreach ($values as $val) {
                $value .= 'case "'.addslashes($val).'": ';
            }
        } else {
            $value = 'case "'.$value.'": ';
        }
        $parseStr = '<?php '.$value.' ?>'.$content;
        $isBreak = isset($tag['break']) ? $tag['break'] : '';
        if ('' == $isBreak || $isBreak) {
            $parseStr .= '<?php break;?>';
        }

        return $parseStr;
    }
public function _case(array $tag = [], $content = '')
    {
        $value = $tag['value'];
        if ('$' == substr($value, 0, 1)) {
            $varArray = explode('|', $value);
            $value = array_shift($varArray);
            $value = $this->autoBuildVar(substr($value, 1));
            if (count($varArray) > 0) {
                $value = $this->tpl->parseVarFunction($value, $varArray);
            }
            $value = 'case '.$value.': ';
        } elseif (strpos($value, '|')) {
            $values = explode('|', $value);
            $value = '';
            foreach ($values as $val) {
                $value .= 'case "'.addslashes($val).'": ';
            }
        } else {
            $value = 'case "'.$value.'": ';
        }
        $parseStr = '<?php '.$value.' ?>'.$content;
        $isBreak = isset($tag['break']) ? $tag['break'] : '';
        if ('' == $isBreak || $isBreak) {
            $parseStr .= '<?php break;?>';
        }

        return $parseStr;
    }
case标签解析 需要配合switch才有效


@param array $tag 标签属性
@param string $content 标签内容

@return string