Think/Template/TagLib.php
public function autoBuildVar($name)
    {
        if (strpos($name, '.')) {
            $vars = explode('.', $name);
            $var = array_shift($vars);
            $name = '$'.$var;
            foreach ($vars as $key => $val) {
                if (0 === strpos($val, '$')) {
                    $name .= '["{'.$val.'}"]';
                } else {
                    $name .= '["'.$val.'"]';
                }
            }
        } elseif (!defined($name)) {
            $name = '$'.$name;
        }

        return $name;
    }
public function autoBuildVar($name)
    {
        if (strpos($name, '.')) {
            $vars = explode('.', $name);
            $var = array_shift($vars);
            $name = '$'.$var;
            foreach ($vars as $key => $val) {
                if (0 === strpos($val, '$')) {
                    $name .= '["{'.$val.'}"]';
                } else {
                    $name .= '["'.$val.'"]';
                }
            }
        } elseif (!defined($name)) {
            $name = '$'.$name;
        }

        return $name;
    }
自动识别构建变量


@param string $name 变量描述

@return string