修改文件 ThinkPHP\Library\Vendor\Smarty\sysplugins\smarty_internal_templateparser.php
位置在2690行左右
修改函数yy_r121()
function yy_r121(){
if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') {
$smarty_var = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);
$this->_retvalue = $smarty_var;
} else {
// used for array reset,next,prev,end,current
$this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];
$this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
if($this->yystack[$this->yyidx + 0]->minor['var']=="'Think'"){
$ConstName=$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
$ConstNameList=explode("']['",$ConstName);
switch(count($ConstNameList)){
case 1:
$ConstName=str_replace("['",'',$ConstName);
$ConstName=str_replace("']",'',$ConstName);
$ConstName='('.strtoupper($ConstName).')';
break;
case 2:
$ConstName0=str_replace("['",'',$ConstNameList[0]);
$ConstName0=str_replace("']",'',$ConstName0);
$ConstName1=str_replace("['",'',$ConstNameList[1]);
$ConstName1=str_replace("']",'',$ConstName1);
$ConstName='$_'.strtoupper($ConstName0).'[\''.strtoupper($ConstName1).'\']';
break;
case 3:break;
}
$this->_retvalue='('.strtoupper($ConstName).')';
}else{
$this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']).$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
}
}
}