简体   繁体   English

会话变量在页面之间丢失或使用相同的变量

[英]session variables lost between pages or use same variables

Yesterday I learn many thing from you, especially from Marc and my problem was solved ( session variables lost between pages or use same variables ). 昨天,我从您那里学到了很多东西,尤其是从Marc那里,我的问题已解决( 会话变量在页面之间丢失或使用相同的变量 )。

But now I continue asking: I don't want to use Session ID(session.use_trans_sid = 1) between pages. 但是现在我继续问:我不想在页面之间使用会话ID(session.use_trans_sid = 1)。 But also I don't want to use same session variables for different users at same application and also I don't want lost session variables between pages for same user. 但是我也不想为同一应用程序中的不同用户使用相同的会话变量,也不想为同一用户的页面之间丢失会话变量。

Is it possible? 可能吗? If yes how? 如果是,怎么办? Thanks for everybody for any help. 感谢大家的帮助。 Best regards. 最好的祝福。

I have Wamp Server(2.2.11) with PHP(5.2.9.-2). 我有Wamp Server(2.2.11)和PHP(5.2.9.-2)。

My php.ini's session settings at below: 我的php.ini的会话设置如下:

[Session]
session.save_handler = files
session.save_path = "c:/wamp/tmp"
session.use_cookies = 0
;session.cookie_secure =
;session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly = 
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

I solved this problem with setting different session_name at php script with using cookies. 我通过使用cookie在php脚本中设置不同的session_name来解决此问题。

通过使用session.use_cookie=1 ,它将为每个用户生成不同的会话ID。

The best way to do sessions is by using cookies. 进行会话的最佳方法是使用Cookie。

session.use_cookies = 1

If you are finding that people are using other people's sessions (presumably by using a computer that hasn't been logged out), try setting a short cookie lifetime: 如果您发现人们正在使用其他人的会话(大概是通过使用尚未注销的计算机),请尝试设置较短的Cookie寿命:

session.cookie_lifetime = 600 ; 10 minutes

If you are having a different issue, it would be helpful if you could give some more details. 如果您遇到其他问题,请提供更多详细信息将很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM