Template类改进 模板解析增加 $Request. 特殊变量解析

This commit is contained in:
thinkphp
2016-06-28 19:31:48 +08:00
parent 438330a4b2
commit dea2a72038

View File

@@ -854,6 +854,11 @@ class Template
if ('$Think' == $first) { if ('$Think' == $first) {
// 所有以Think.打头的以特殊变量对待 无需模板赋值就可以输出 // 所有以Think.打头的以特殊变量对待 无需模板赋值就可以输出
$parseStr = $this->parseThinkVar($vars); $parseStr = $this->parseThinkVar($vars);
} elseif ('$Request' == $first) {
// 获取Request请求对象参数
$method = array_shift($vars);
$params = !empty($vars) ? '\'' . implode('.', $vars) . '\'' : '';
$parseStr = '\think\Request::instance()->' . $method . '(' . $params . ')';
} else { } else {
switch ($this->config['tpl_var_identify']) { switch ($this->config['tpl_var_identify']) {
case 'array': // 识别为数组 case 'array': // 识别为数组