Home > php教程 > php手册 > 修复设置SESSION前缀情况下模板中$Think.session失效

修复设置SESSION前缀情况下模板中$Think.session失效

WBOY
Release: 2016-06-07 11:38:16
Original
1446 people have browsed it

修复设置SESSION前缀情况下模板中$Think.session失效
设置SESSION前缀情况下模板中类似$Think.session.admin.info失效
ThinkPHP\Library\Think\Template.class.php 605行开始case 'COOKIE':<br>     if(isset($vars[3])) {<br>         $parseStr = '$_COOKIE[\''.$vars[2].'\'][\''.$vars[3].'\']';<br>     }else{<br>         $parseStr = 'cookie(\''.$vars[2].'\')';<br>     }<br>     break;<br> case 'SESSION':<br>     if(isset($vars[3])) {<br>         $parseStr = '$_SESSION[\''.$vars[2].'\'][\''.$vars[3].'\']';<br>     }else{<br>         $parseStr = 'session(\''.$vars[2].'\')';<br>     }<br>     break;修改为case 'COOKIE':<br>     if(isset($vars[3])) {<br>         $prefix=C('COOKIE_PREFIX');<br>         $prefixStr=empty($prefix) ? '' : "['".$prefix."']";<br>         $parseStr = '$_COOKIE'.$prefixStr.'[\''.$vars[2].'\'][\''.$vars[3].'\']';<br>     }else{<br>         $parseStr = 'cookie(\''.$vars[2].'\')';<br>     }<br>     break;<br> case 'SESSION':<br>     if(isset($vars[3])) {<br>         $prefix=C('SESSION_PREFIX');<br>         $prefixStr=empty($prefix) ? '' : "['".$prefix."']";<br>         $parseStr = '$_SESSION'.$prefixStr.'[\''.$vars[2].'\'][\''.$vars[3].'\']';<br>     }else{<br>         $parseStr = 'session(\''.$vars[2].'\')';<br>     }<br>     break;

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template