PHP 会话和 iPhone
我正在用 PHP 开发一个在线会员系统,并使用 PHP 会话来管理对系统的访问。到目前为止,这种方法效果很好,但是当我从 iPhone 或通过手机连接访问系统时,会话不断过期。我认为这是因为蜂窝设备(至少在我的运营商上)的 IP 地址不断变化。我的问题是我该如何解决这个问题?我希望能够通过蜂窝连接访问该网站。
干杯,
萨姆
I am developing an online membership system in PHP and I use PHP sessions to manage access to the system. This has worked well so far, however when I access the system from an iPhone or over my phones connection, the session keeps expiring. I suppose that this is because the IP addresses for cellular devices (at least on my carrier) continuously change. My question is how do i work around this? I want to be able to access this site over a cellular connection.
Cheers,
Sam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,确保更改的 IP 确实是问题所在。您可以在连接 WiFi 时使用 iPhone 上的应用程序进行测试。如果在这种情况下也不起作用,则问题可能与 WebKit 相关。
如果改变的 IP 确实是问题所在,那么要么是您的服务器配置在整个单个会话中强制使用恒定的 IP,要么是您的服务器端应用程序这样做。如果你弄清楚两者中的哪一个,你就可以改变它。
但是,有充分的理由为单个会话强制使用恒定的 IP,所以要小心。
另外,我不认为你的手机 IP 会经常改变,所以我猜测问题出在其他地方。
First, make sure that the changing IP is actually the problem. You could test this by using the app on your iPhone when on WiFi. If it also doesn't work in that case, the issue may be WebKit-related.
If the changing IP really is the problem, it is either your server configuration that enforces a constant IP throughout a single session, or it is your server side application that does so. If you figure out which of the two, you could change it.
But, there are good reasons to enforce a constant IP for a single session, so be careful.
Also, I don't think your phone's IP will change all that often, so my guess is that the problem is elsewhere.