简体   繁体   English

Facebook Javascript vs PHP SDK

[英]Facebook Javascript vs PHP SDK

I am somewhat confused by the facebook developers guide. 我对facebook开发者指南感到有些困惑。 Some tutorials show the javascript SDK being used while some show the PHP SDK being used. 一些教程显示正在使用的javascript SDK,而有些则显示正在使用的PHP SDK。 Do I need to load both of these? 我需要加载这两个吗? Are there any differences between the two (besides one being client and one being server)? 两者之间是否有任何差异(除了一个是客户端,一个是服务器)?

I am wanting to use Facebook's SDK for User Authentication, Social Plugins, and the Graph API. 我想使用Facebook的SDK进行用户身份验证,社交插件和Graph API。

The best advice I can give you - be very careful when planning a new development on the Facebook Platform. 我可以给你的最佳建议 - 在Facebook平台上规划新的开发时要非常小心。 A lot of the documentation is seriously out of date, and this is exacerbated by sporadic platform revisions. 许多文档严重过时,零星的平台修订加剧了这种情况。

Admittedly, this has improved in recent months, but I digress... 不可否认,最近几个月这种情况有所改善,但我离题了......

Facebook have recently deprecated the creation of FBML canvas applications, which means your application will have to be in an iframe. Facebook最近不赞成创建FBML画布应用程序,这意味着您的应用程序必须位于iframe中。 This also implies you could make the applications available off of Facebook too (eg, http://apps.facebook.com/someapp/ and http://www.someapp.com/ can both load up). 这也意味着您也可以通过Facebook提供应用程序(例如, http://apps.facebook.com/someapp/http://www.someapp.com/都可以加载)。 This narrows the benefits of using the PHP SDK, as a lot of the functionality is available via the JavaScript API. 这缩小了使用PHP SDK的好处,因为许多功能都可以通过JavaScript API获得。

For SDK authentication you should use the Javascript SDK. 对于SDK身份验证,您应该使用Javascript SDK。 It's much easier to set up things properly. 设置正确的东西要容易得多。

For the Graph API, it depends what kind of application you are going to build. 对于Graph API,它取决于您要构建的应用程序类型。 If you are storing or processing stuff on the server side then you will have to use the PHP SDK. 如果要在服务器端存储或处理内容,则必须使用PHP SDK。

You don't need to use an SDK for their Social plugins. 您不需要为其社交插件使用SDK。 You just have to copy-paste sample code in most cases. 在大多数情况下,您只需复制粘贴示例代码即可。

Many tasks/calls can be done by javascript. 许多任务/调用可以通过javascript完成。 I use both for my. 我用这两个。 85% JavaScript and 15% PHP. 85%的JavaScript和15%的PHP。 Reason: If you have an App with > 10000 dau's, the PHP SDK will suck sometimes, because every api-call needs at least 0.3s via cURL on my machine. 原因:如果你有一个> 10000 dau的应用程序,PHP SDK有时会很糟糕,因为每个api-call在我的机器上通过cURL需要至少0.3秒。

My Opinion: Use PHP SDK only if necessary 我的意见:仅在必要时使用PHP SDK

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

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