[英]Zend session not working properly
I'm trying to work with Zend Sessions and after failing for a while, I tried basic counter example: 我正在尝试使用Zend Sessions,并且在失败了一段时间之后,尝试了基本的反例:
$defaultData = new Zend_Session_Namespace('language');
if(isset($defaultData->counter))
{
$defaultData->counter = 1;
} else {
$defaultData->counter++;
}
echo $defaultData->counter;
But on each page refresh I get the value 1. I'm calling Zen_Session::start in Bootstrap autoloader. 但是在每个刷新页面上,我都得到值1。我在Bootstrap自动加载器中调用Zen_Session :: start。 What are the possible ways to debug, solve this problem?
有什么可能的方法来调试,解决此问题?
Your if-else
is the wrong way around. 您的
if-else
是错误的方法。 Now, if there is a session variable, you assign the value '1'. 现在,如果有一个会话变量,则分配值“ 1”。 So, change statements for if and else and you will be fine.
因此,更改if和else的语句,就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.