在facebook canvas应用程序中无法获取url参数?

时间:2012-07-04 14:50:10

标签: php facebook

我正在开发一个Facebook画布应用程序 当我点击链接时,它必须打印testid并根据index.php上的代码查看从url获取的变量

https://apps.facebook.com/gayriciddi/

的index.php:

<?php
include ('config.php');
include ('db_fns.php');
header('Content-type: text/html; charset=UTF-8'); 

print_r($fbme);
$access_token = $facebook->getAccessToken();

//records users to database
create_user($fbme, $access_token); 

$view = empty($_GET['view']) ? 'home' : $_GET['view'];

$controller = 'page';

echo '<br />'.$view;

$testid = $_REQUEST['testid'];

echo '<br />'.$testid.'<br />';

switch($view){

    case 'home':
        $testler = select_tests();   
    break;

    case 'acilis':

    break;

    case 'sayfa':

    break;

    case 'kapanis':

    break;
}

//includes $view.php  $view is home, acilis, sayfa or kapanis
include(WEBSITE_ROOT.'/views/'.$controller.'.php');
?>

home.php:

    <table width="601" border="0">
 <?php foreach($testler as $key => $test){?>
  <tr>
    <td width="53">&nbsp;</td>
    <td width="420"><a href="<?=FB_BASE_URL?>index.php?view=acilis&testid=<?=$test['id']?>" target="_top"><?php echo $test['ad'];?></a></td>
    <td width="50">&nbsp;</td>
    <td width="50">&nbsp;</td>
  </tr>
 <?php } ?>
</table>

如果您查看我在顶部给出的链接,则定义所有变量。当我点击链接时,它必须打印testid并根据index.php上的代码查看从url获取的变量

$view = empty($_GET['view']) ? 'home' : $_GET['view'];

$controller = 'page';

echo '<br />'.$view;

$testid = $_REQUEST['testid'];

但它没有。也许它有非常简单的解决方案,但我无法找到它。

另一方面,当我在原始网址(http://www.olmasigereken.com/gayriciddi/)中执行同样的操作时,会按预期打印$ view和$ testid。

0 个答案:

没有答案