简体   繁体   English

如何在Facebook应用画布上显示数据?

[英]How to show data on a facebook app canvas?

I have tried following some tutorials and I get the concept of how the apps work, basicly they are in my case a php/mysql site that loads into facebook and gives me access to the userbase instead of needing my own userbase. 我尝试了一些教程,并获得了应用程序工作原理的概念,就我而言,它们基本上是一个php / mysql站点,可加载到Facebook中并为我提供访问用户群的权限,而无需我自己的用户群。

Here is what I am trying right now to show on the facebook application canvas page 这是我现在想在Facebook应用程序画布页面上显示的内容

/* initialize the facebook API with your application API Key
  and Secret */
$facebook = new Facebook('MY API KEY','MY API SECRET');

/* require the user to be logged into Facebook before
  using the application. If they are not logged in they
  will first be directed to a Facebook login page and then
  back to the application's page. require_login() returns
  the user's unique ID which we will store in fb_user */
$fb_user = $facebook->require_login();

/* now we will say:
  Hello USER_NAME! Welcome to my first application! */
?>


Hello <fb:name uid='<?php echo $fb_user; ?>' useyou='false' possessive='true' />! Welcome to my first application!

Instead of showing anything from my script though it just shows these errors when I access the facebook page 虽然我访问facebook页面时仅显示这些错误,但并未显示脚本中的任何内容

Errors while loading page from application
Parse errors:
CSS Error (line 35 char 17): Error in parsing value for property.: 'font-style'  Declaration dropped.
FBML Error (line 53): illegal tag "body" under "fb:tab-position"
FBML Error (line 54): illegal attr ";" in tag "div". Attribute names can only contain alphanumeric characters, underscores, and hyphens.FBML Error (line 85): illegal tag "object" under "fb:tab-position"
FBML Error (line 86): illegal tag "param" under "fb:tab-position"
FBML Error (line 87): illegal tag "param" under "fb:tab-position"
FBML Error (line 88): illegal tag "embed" under "fb:tab-position"
FBML Error (line 221): illegal tag "object" under "fb:tab-position"
FBML Error (line 222): illegal tag "param" under "fb:tab-position"
FBML Error (line 223): illegal tag "param" under "fb:tab-position"
FBML Error (line 225): illegal tag "embed" under "fb:tab-position"
FBML Error (line 264): illegal tag "object" under "fb:tab-position"
FBML Error (line 265): illegal tag "param" under "fb:tab-position"
FBML Error (line 266): illegal tag "param" under "fb:tab-position"
FBML Error (line 268): illegal tag "embed" under "fb:tab-position"
FBML Error (line 276): illegal tag "noscript" under "fb:tab-position"
FBML Error (line 321): illegal tag "noscript" under "fb:tab-position"
Runtime errors:
Cannot allow external script

The weird thing is I can remove all this from my page and just try to show basic text or anything on the canvas page and it will still give me these errors, am I missing something? 奇怪的是,我可以从页面上删除所有这些内容,而只是尝试在画布页面上显示基本文本或任何内容,它仍然会给我这些错误,我是否缺少某些内容?

Facebook is most definitely loading some sort of HTML. Facebook无疑是在加载某种HTML。 Since you've said that even when your page is almost entirely blank you still get these errors, have you confirmed that your Facebook app is, in fact, pointing to the correct URL? 既然您说过,即使页面几乎完全空白,您仍然会遇到这些错误,您是否已确认您的Facebook应用实际上指向了正确的URL?

I'm also assuming that you tried to access the PHP script from your own browser, too, to ensure that your script is printing what you think it is. 我还假设您也尝试从自己的浏览器访问PHP脚本,以确保您的脚本能打印出您认为的样子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM