dongsha9208 2014-02-01 05:44
浏览 79
已采纳

两个单独页面的不需要的独立会话

I am stumped. Everybody says if you use session_start that you should get a single session even when you open multiple browser windows. However, it seems that my sessions are page specific.

When I load page one (index.php), it gives as a Session ID: sr51j9hhrjjrvbrfboek15l4e4 with an empty $_SESSION array

I then log in on a webpage (login.php) that generates a new Session ID: v2t8844nglg7uvnsrbr6k9ms43 with a $_SESSION array with various variables.

When I then reload page one, it will display the old session ID, not the new one as expected. It is page linked because if I copy load page two in tab one, it will give the same session ID as the page in tab 2, and visa versa.

I have added the rule

CacheDisable /local_files

to the httpd.conf file with no effect.

I uses Apache 2.4 (XAMPP installation for windows), with the http://php-login.net advanced login script.

Top of page (before the HTML tag):

session_start();

require_once('includes/connection.php');

followed by:

echo var_dump($_SESSION);

echo session_save_path();

echo 'Session ID: '.session_id();

at the top of the page in the body tag. Any suggestions?

  • 写回答

2条回答 默认 最新

  • duanfei7508 2014-02-01 06:19
    关注

    Okay, found the answer here: My session ID's stopped working

    One page was localhost:8001, while the second was 127.0.0.1:8001, which are treated by the server as two separate pages for the purpose of sessions, while serving the same page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。
  • ¥15 SQL Server analysis services 服务安装失败