简体   繁体   English

PHP会话回声不起作用?

[英]PHP session echo not working?

I have a page that generates a $_SESSION['variable'] that is dynamic, so when you refresh the page the session has a different value everytime ( just a value of 0-10 ). 我有一个页面生成一个动态的$ _SESSION ['variable'],因此,刷新页面时,会话每次都具有不同的值(只是0-10的值)。 But when I refresh the page in firefox, nothing shows up, but in IE it works fine. 但是,当我在firefox中刷新页面时,什么都没有显示,但是在IE中它可以正常工作。 I also tried in Opera but it doesn't show up there either. 我也在Opera中尝试过,但也没有出现。 Anyone know why it's not echoing, and yes I session_start() at the top of my page so it should work... 任何人都知道为什么它没有回声,是的,我在页面顶部使用了session_start(),所以它应该可以工作...

I had a sort-of similar problem just now and the problem was due to the prefix of my URL.! 我刚才遇到了类似的问题,该问题是由于我的URL前缀造成的。

Let me explain, I defined my session in a page starting WITH "www." 让我解释一下,我在以“ www”开头的页面中定义了会话。 but the href to the second page was hastily defined without "www." 但是草草定义了第二页的href,没有“ www”。 at the beginning. 一开始。 After checking the COOKIES I realized that there were two distinct IDs for my sessions. 在检查了COOKIES之后,我意识到我的会话有两个不同的ID。 Hope it helps. 希望能帮助到你。

Are cookies enabled on Firefox? 在Firefox上启用了cookie吗? If they are not you have to enable passing the session ID through the query string. 如果不是,则必须启用通过查询字符串传递会话ID。 I think that is disabled by default. 我认为默认情况下是禁用的。

Do you have firebug installed for firefox? 您是否为Firefox安装了萤火虫? If so, do you have the firecookie addon 如果是这样,您是否有firecookie插件

If so, you should see the presence of PHPSESSID. 如果是这样,您应该看到PHPSESSID的存在。 If you don't see any cookies, then chances are, this is your issue. 如果您没有看到任何Cookie,那么很可能是您的问题。

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

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