【问题标题】:PHP session is not working with FirefoxPHP 会话不适用于 Firefox
【发布时间】:2016-03-09 09:32:06
【问题描述】:

仅当我使用 Firefox 登录时才会发生这种情况, 这是什么原因,我怎样才能让这个会话在 Firefox 中工作?

    <?php
    session_start();

    $username=$_SESSION["username"];

    $sql="select * from person where username ='".$username."'";

【问题讨论】:

  • 会话总是存储在服务器上:)
  • 会话标识符存储在浏览器中。查看您的 cookie 和其他设置。
  • 解决办法是什么?
  • @Matt 当我使用 firefox 访问我的应用程序时会发生这种情况
  • @ruvi:在其他浏览器中运行正常吗?

标签: php session firefox


【解决方案1】:

您的问题似乎与缓存有关。

使用下面的标题来消除缓存问题。在session_start()之后添加。

header("Cache-Control: no-cache");
header("Pragma: no-cache");

希望对你有帮助:-)

【讨论】:

  • 是的,它可以通过其他浏览器工作。我用上面的线,但它仍然不工作
猜你喜欢
  • 1970-01-01
  • 2017-07-30
  • 2010-09-23
  • 1970-01-01
  • 1970-01-01
  • 2018-01-27
  • 1970-01-01
  • 1970-01-01
  • 2017-03-01
相关资源
最近更新 更多