-1

我尝试通过 singed_request 为我的 facebook 粉丝页面制作粉丝门内容。代码完美运行,但我不想在 iframe 中重定向,我需要在用户单击 LIKE 后重定向到另一个页面。我如何删除 iframe 并插入重定向?

这是我的代码:

<?php
require_once('facebook.php');
$app_id = "id";
$app_secret = "secret";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
function parsePageSignedRequest() { if (isset($_REQUEST['signed_request'])) {     $encoded_sig = null; $payload = null; list($encoded_sig, $payload) = explode('.',     $_REQUEST['signed_request'], 2); $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));     $data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true)); return     $data; } >return false; } if($signed_request = parsePageSignedRequest()) {     if($signed_request->page->liked) { echo "<iframe allowtransparency=\"true\"     frameborder=\"0\" SCROLLING=\"YES\" style=\"width: 800px; height: 1000px;\"     src=\"http://onlyimagination.com/dm3theme2\" id=\"any_name\" name=\"anyname\"><iframe>";
} else { echo "<img src=\"http://www.onlyimagination.com/facebook/crazyvideo/img.jpg\"     width=\"582\" height=\"487\">"; } }
?>
4

1 回答 1

1

这仅在您的代码之前没有任何输出时才有效

if ($signed_request = parsePageSignedRequest()) {
    if ($signed_request->page->liked) {
        header('Location: http://onlyimagination.com/dm3theme2');
    } else {
        echo "<img src=\"http://www.onlyimagination.com/facebook/crazyvideo/img.jpg\"     width=\"582\" height=\"487\">";
    }
}
于 2012-08-16T07:43:52.270 回答