我有一个facebook iframe应用程序而不是粉丝页面 当我使用这段代码时,它打印得很好
$signed_request = $facebook->getSignedRequest();
print_r($signed_request);
打印:
Array (
[algorithm] => HMAC-SHA256
[expires] => 1341475200
[issued_at] => 1341470027
[oauth_token] =>...
[user] =>
Array (
[country] => tr
[locale] => en_US
[age] => Array ( [min] => 21 )
)
[user_id] => ...
)
但是当我更改地址栏中的网址如https://apps.facebook.com/myappname/?app_data=hello
并按下输入时,它不会在数组中打印app_data = hello参数。我怎么打印出来?
我的应用是iframe应用。看看这张照片 您可以转到我的应用http://apps.facebook.com/gayriciddi/并点击主页上的链接,然后查看
$view = empty($_GET['view']) ? 'home' : $_GET['view'];
echo '<br />'.$view;
$testid = $_REQUEST['testid'];
echo '<br />'.$testid.'<br />';
代码是否有效
我的index.php:
<?php
include ('config.php');
include ('db_fns.php');
header('Content-type: text/html; charset=UTF-8');
print_r($fbme);
$controller = 'page';
$view = empty($_GET['view']) ? 'home' : $_GET['view'];
echo '<br />'.$view;
$testid = $_REQUEST['testid'];
echo '<br />'.$testid.'<br />';
$signed_request = $facebook->getSignedRequest();
print_r($signed_request);
//includes home.php
include(WEBSITE_ROOT.'/views/'.$controller.'.php');
?>
my home.php:
<table width="601" border="0">
<?php foreach($testler as $key => $test){?>
<tr>
<td width="53"> </td>
<td width="420"><a href="<?=FB_BASE_URL?>?view=acilis&testid=<?=$test['id']?>" target="_top"><?php echo $test['ad'];?></a></td>
<td width="50"> </td>
<td width="50"> </td>
</tr>
<?php } ?>
</table>
答案 0 :(得分:0)
只需使用$ _GET ['app_data'],因为它不像页面标签页中那样是已签名的请求的一部分