会话数据丢失 [英] session data getting lost

查看:96
本文介绍了会话数据丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会话数据在PHP版本4.4.1中丢失了以前工作在

版本4.3.3


代码类似于下面


假设文件名为count.php,需要参数

productid;


session_start() ;

if(!isset($ _ SESSION [''countAccess'']))$ _SESSION [''countAccess''] = 0;

else $ _SESSION [' 'countAccess''] ++;


echo $ _SESSION [''countAccess''];

如果我用参数调用脚本例如<当我按下刷新按钮$ _SESSION [''countAccess'']时,
count.php?productid = 78




递增但如果我在没有参数的情况下调用它,

$ _SESSION [''countAccess'']会增加。

如果我调用另一个脚本,我也会丢失数据。


有谁知道这里发生了什么?


谢谢

Session data is getting lost in PHP version 4.4.1 which used to work in
version 4.3.3

The code is similar to the one below

Assume the file is called count.php which requires a parameter
productid;

session_start();
if (!isset($_SESSION[''countAccess''])) $_SESSION[''countAccess''] = 0;
else $_SESSION[''countAccess'']++;

echo $_SESSION[''countAccess''];
if I call the script with a parameter for example
count.php?productid=78

when I press refresh button $_SESSION[''countAccess''] does not get
incremented but if I call it without the parameter,
$_SESSION[''countAccess''] gets incremented.
I am also losing data if I call another script.

Does anyone know what''s going on here?

Thank you

解决方案

_SESSION [''countAccess'']))
_SESSION[''countAccess'']))


_SESSION [''countAccess''] = 0;

else
_SESSION[''countAccess''] = 0;
else


_SESSION [''countAccess''] ++;


echo
_SESSION[''countAccess'']++;

echo


这篇关于会话数据丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆