0

我有这个 index.php,它告诉我要包含什么。我想在带有扇形门控选项的选项卡中拥有一个子页面。有人可以帮助我并告诉我我的代码有什么问题吗?我不是很喜欢 php。

    <?php

require 'src/facebook.php';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId' => '262995697152250',
  'secret' => '7ad8d22dc1b0224b4bb226d0085b4063',
));

$user = $facebook->getUser();

if ($user) {
  try {
    $likes = $facebook->api("/me/likes/286599224689000");
    if( !empty($likes['data']) )
        echo "I like!";
    else
        echo "not a fan!";
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl(array(
    'scope' => 'user_likes'
  ));
}

$signed_request = $facebook->getSignedRequest();

$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];




include ("header.php");
if(!isset($_GET['page'])) $_GET['page']="";
switch($_GET['page']) {
case "1": include('leftside.html'); include('informace.html'); break;
case "2": include('reference.html'); break;
case "3": include('clanky.html'); ;break;
case "4":
// If a fan is on your page
if ($like_status) {
include ("formular.html");
} else {
// If a non-fan is on your page
include ("nonfan.html");}
;break;

case "5": include('clanok1.html'); break;
case "6": include('clanok2.html'); break;
case "7": include('clanok3.html'); break;
case "8": include('clanok4.html'); break;
case "9": include('leftside.html'); include('vyhody.html'); break;

default: include('leftside.html'); include('informace.html');
}
include ("footer.html");
?>
4

1 回答 1

0

要将变量传递给页面选项卡,您必须使用app_data变量,该变量可以使用signed_request解码。请参阅此处: 将自定义参数传递给 facebook 粉丝页面选项卡

于 2012-09-04T14:47:17.017 回答