PHP会话不适用于IE [英] PHP session doesn't work with IE

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

问题描述

我有一个用php制作的网站,它使用整个网站的服务器端会话。

实际上,这是一个用户登录的网站,它取决于会话变量以及是否存在所有会话变量,根本不加载任何页面。

I have a site made with php which uses server side sessions throughout the site.
In fact, it's a site with a user login which depends on session variables and if there were a problem with all session variables, no pages would load at all.

在网站上,有一个iframe,其中包含来自其他用户的小消息。

这些小消息旁边有可点击的照片打开用户的个人资料。

现在,每个页面都需要一些格式来打开该特定页面上的用户个人资料...实际上只有少数问题页面,但这些页面有让onclick函数的格式有点不同或者它们会破坏页面。

所以我在每个页面上设置一个会话变量( $ _ SESSION [current_page] )让Feed知道如何格式化可点击的照片。现在Firefox,Opera,Chrome,Safari都可以正常工作。

但IE6和IE7在需要特殊格式化的页面上出现问题。

所以拉完头发后稍微说,我最终开始从服务器打印我的会话变量。

并且在特殊页面上看,( $ _ SESSION [current_page] )始终设置为main而不是special1或special2。

On the site, there's an iframe that holds a feed of little messages from other users.
Those little messages have clickable photos next to them that open the user's profile.
Now, each page requires some formatting to open the user's profile on that specific page...there's really only a few problem pages, but those pages have to have the onclick functions formatted a little differently or they break the page.
So I set a session variable on each page ($_SESSION["current_page"]) that lets the feed know how to format the clickable photos. Now Firefox, Opera, Chrome, Safari all work as they are supposed to.
But IE6 and IE7 are having problems on the pages that require special formatting.
So after pulling my hair out a bit, I eventually got around to printing my session variables form the server.
And lo and behold, on the special pages, ($_SESSION["current_page"]) is always set to "main" instead of "special1" or "special2".

我在Firefox和我提到的所有其他浏览器中打印了相同的会话变量,并打印出special1或special2,因为它们应该如此。 >
有人能想到什么 - 可能与饲料在iframe中的事实有关吗? - 这将导致IE以不同方式处理服务器端会话变量或以某种方式在后台以静默方式启动页面主?

我已经非常仔细地检查了对于main页面的任何引用 - 它没有'似乎有任何方式它加载该页面。

I printed the same session variable in Firefox and all the other browsers I mentioned and they print out "special1" or "special2" as they're supposed to.
Can anyone think of something - possibly related to the fact that the feed is in an iframe??? - that would cause IE to treat server side session variables differently or somehow launch page "main" silently in the background?
I have checked the feed very carefully for any reference to page "main" - it doesn't seem like there's any ways it's loading that page.

这对我没有意义。

推荐答案

我认为有些人可能会觉得这个问题的解决方案很有意思。提琴手肯定在这里帮忙。感谢Fiddler,我可以看到我实际上正在访问页面main.php(因此在将目标页面设置到目标页面后设置会话变量),但是服务器在获取302的根目录后默认为网站。这一切都在后台默默发生,之前我的onload =javascript运行。

I thought some people might find the solution to this problem interesting. Fiddler certainly helped here. Thanks to Fiddler, I could see that I was, in fact, hitting the page main.php (thus setting the session variable moments after setting it on the target page), but the server was defaulting there after getting a 302 on the root of the site. This was all happening silently in the background, and before my onload="" javascript ran.

所以我确定 这些页面上的某些内容导致错误,但不是灾难性的。

So I was sure something on those pages was causing an error, but not a catastrophic one.

这里是:< img src =>

IE吓坏了关于空白src属性并命中服务器root和默认为page main。我不完全理解这里发生的机制。我也不明白这是不是IE应该如何表现(毕竟它是一个格式错误的img标签)。这是一个错误吗?

IE was freaking out about the blank src attribute and hitting the server root and the defaulting to page main. I don't fully understand the mechanics happening here. I also don't understand if this is how IE is supposed to behave (it is a malformed img tag after all) or not. Is this a bug?

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

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