[英]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. 我对php很陌生,正在尝试将数据从c#发送到php脚本,然后将其发布到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: 再往下看,检查用户是否未登录facebook后,我有:
$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. 然后,我在c#中使用此URL打开用户的浏览器,他们可以在其中通过我的Facebook应用程序登录到Facebook。
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#. 现在,据我所知,
$login_url
将允许用户登录Facebook,然后返回到该php页面,这是我丢失从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. 此外,在使用
var_dump($_SESSION)
检查其中是否包含$_SESSION['foo']
,它包含一些Facebook会话变量,但没有高分。
你确定你所得到的$_POST['Facebook']
Facebook在参数$_POST
,因为我在代码中看看有没有问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.