0
以下代码涉及使用由php表单事件触发的脚本对Facebook应用程序用户进行身份验证。我通过一个HTML表单张贴字符串下面的代码:执行后丢失php发布的字符串变量信息top.location.href
<html>
<body>
<form name="form" enctype="multipart/form-data" action="test.php" method="post">
<input name="message" type="text" value=""><br/><br/>
<input type="submit" value="Upload"/><br/>
</form>
</body>
</html>
为test.php的代码是:
<html>
<head xmlns:testapp="https://apps.facebook.com/testapp/ns#">
<title>World Centric</title>
</head>
<body>
<?php
$app_id = "191622610935428";
$my_url = "http://www.thepropagator.com/facebook/testapp";
$string1 = $_POST["message"];
session_start();
$_SESSION['string']=$string1;
echo $string1;
$code = $_REQUEST["code"];
if(empty($code))
{
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url)
. "&scope=email,publish_actions";
echo("<script>top.location.href='" . $dialog_url . "'</script>");
echo "string1".$string1;
}
$string1 = $_SESSION['string'];
echo $string1;
?>
</body>
</html>
当text.php最初实行的是回波从表单张贴的字符串
$string1 = $_POST["message"];
行之后不过:
echo("<script>top.location.href='" . $dialog_url . "'</script>");
执行变量$ string1出现空。上面的行执行后,我需要保留这些信息。任何人都可以提出我可以如何实现这一点?
感谢您的建议。我相信你是对的,但我在实施解决方案时遇到了麻烦。我在上面的原始代码块中编辑了我的代码更改,但我仍然遇到与丢失信息相同的问题。任何关于我在做什么的错误? – 2012-01-16 03:17:38