简体   繁体   中英

php session variable not saving

I am quite new to php and am trying to send data from c# to a php script which then posts to facebook.

The trouble is, after I receive the data I can't store it in the session array.

Here's what I've got:

session_start();

if($_POST['Facebook'])
{
    echo 'DataReceived';
    $HighScore = $_POST['Facebook'];
    $_SESSION[1] = $HighScore;
}

$_SESSION['foo'] = 'bar';

Further down, after checking if the user is not logged into facebook I have:

$login_url = $facebook->getLoginUrl($params = array('scope' => "publish_stream",));
echo $login_url;

I then use this url in c# to open the user's browser where they can login to facebook through my facebook app.

Now, as far as I can tell, the $login_url will allow the the user to log into facebook then go back to this php page, this is where I lose the data that I sent from c#.

Also, after using var_dump($_SESSION) to check what was there and it contained $_SESSION['foo'] , some facebook session variables, but not the highscore.

你确定你所得到的$_POST['Facebook'] Facebook在参数$_POST ,因为我在代码中看看有没有问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM