如何深入链接到Facebook应用程序(非页面选项卡) [英] How to deep link to a Facebook App (NOT Page Tab)

查看:317
本文介绍了如何深入链接到Facebook应用程序(非页面选项卡)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要链接到我的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.

这是网址格式:
https://apps.facebook.com/myappname

我需要在最后传递参数(如/next.html或?page = next),以便我可以直接从应用程序(从电子邮件)链接到特定页面。

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).

我该如何设置?我的项目使用PHP和jQuery。我希望能够在Javascript中严格执行此操作。

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.

我已经发现了很多关于如何深入链接页面标签或移动应用的信息,但是不是一般的应用程序。我发现消息说明这是可能的,但没有任何关于如何在网上或Facebook上实际做的事情。

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.

感谢您的帮助。

编辑:

好的,我在PHP中工作。对于有这个问题的其他人,这就是我所做的。

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

添加?在您的FB应用程序的网站URL的最后,然后创建一个与您的应用程序着陆页类似的重定向文件(仅使用绝对路径,而不是像下面所示的相对路径):

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;
}
?>

这个答案是帮助我弄清楚的:
$_GET在Facebook上的iframe应用程序

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

推荐答案

当你使用?所有您正在做的是发出$ _GET请求,所以您需要的所有信息将存在于$ _GET数组中。

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.

而不是查询$ _SERVER数组,查询$ _GET数组。

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

所以如果你有:

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

这篇关于如何深入链接到Facebook应用程序(非页面选项卡)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆