dousao6313 2015-11-25 17:09
浏览 54
已采纳

PHP会话变量和身份验证

I have two pages which I need to pass session information between them. Here's page one.

<?php
session_start();
echo session_id()."<br>";
echo $_SESSION['test']."<br>";

Page two.

<?php
session_start();
echo session_id()."<br>";
$_SESSION['test'] = 'test';
echo $_SESSION['test'];

Page two is in a different directory (same domain), and has Windows Authentication on. Page one is using anonymous authentication. From the output I can see the session ID is the same, but page one doesn't echo the test variable set from page two.

I'm running PHP in IIS 8.5 on Server 2012 R2.

Any help is appreciated.

To clarify, I am calling page two first, and page one will not show the variable.

  • 写回答

3条回答 默认 最新

  • doume5227 2015-11-25 17:41
    关注

    The issue was with permissions on the session save path. I changed the path to where both directories could write and it works.

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

报告相同问题?