Smarty 杀死了我的会话 [英] Smarty kills my session
本文介绍了Smarty 杀死了我的会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用 Smarty 3.1.13 时遇到问题.
I have a problem with Smarty 3.1.13.
Smarty 杀死了我的会话.每次刷新页面时,$_SESSION 数组都是空的.当我注释行 $smarty->display('index.tpl')
时,一切正常.
Smarty kills my session. Every time I refresh my page, $_SESSION array is empty.
When I comment line $smarty->display('index.tpl')
, everything is OK.
有什么想法吗?
推荐答案
你必须在 $smarty->display('index.tpl')
这是因为会话 cookie 需要在 HTTP 标头中发送,因此 session_start 需要在第一行输出之前调用.
This is beacause the session cookie needs to be send in the HTTP header and therefore session_start will need to be called before the first line of output.
所以确保 session_start()
放在 $smarty->display('index.tpl')
这篇关于Smarty 杀死了我的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文