dua55014 2013-02-11 13:23
浏览 52
已采纳

如何深入链接到Facebook应用程序(不是页面选项卡)

I need to link to a specific page in my Facebook app. The app is not in a page tab, and cannot be in one due to the project constrictions.

This is the url format: https://apps.facebook.com/myappname

I would need to pass a parameter at the end (like /next.html or ?page=next) so that I can link to the specific page directly from outside the app (from an email).

How would I set this up? My project uses PHP and jQuery. I would love to be able to do this strictly in Javascript if possible.

I have found tons of info on how to deep link a page tab or a mobile app, but not to a regular application. I have found messages stating it's possible, but nothing about how to actually do it anywhere online or on Facebook.

Thanks for your help.

EDIT:

Okay, I got it working in PHP. For anyone else with this issue, this is what I did.

Add a "?" at the very end of the 'Site URL' in your FB app, then create a redirect file similar to this as your app landing page (just use absolute paths instead of relative ones like I did below):

<?php
$query = $_SERVER['QUERY_STRING'];
$params = explode("/", $query);

if (in_array("gallery", $params)) {
    header("Location: /gallery.html");
    exit;
}
else {
    header("Location: /index.html");
    exit;
}
?>

This answer is what helped me figure this out: $_GET on facebook iframe app

  • 写回答

3条回答 默认 最新

  • dougua3705 2013-02-11 17:46
    关注

    When you are using the ? all you are doing is issuing a $_GET request, so all of the info you require will exist in the $_GET array.

    Rather than query the $_SERVER array, query the $_GET array.

    So if you had:

    http://myurl.com?info=foobar

    You can simply access that info using:

    $info = $_GET['info'];
    

    It is good practice to check for the existence first though:

    if (isset($_GET['info']))
    {
    $info =$_GET['info'];
    }
    else
    {
    $info="default";
    }
    

    Incidently if you use the & character you can have multiple parameters:

    http://myurl.com?info=foo&moreinfo=bar
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?