什么是Social Plugin
引用
Social plugins
Social plugins enable you to provide engaging social experiences to your users with just a line of HTML. Because the plugins are served by Facebook, the content is personalized to the viewer whether or not they have signed into your site.
简单地说:你想在你网站的某个网页上显示一个按钮、一小块html代码等来链接Facebook应用,那么只要引入facebook的API和一段fbml就可以达到目的。
Php代码:
1. <html>
2. <body>
3. "fb-root"></div>
4. </body>
5. </html>
6. <script>
7. // 116344281725102 是一个facebook应用的app id.
8. function() {
9. '116344281725102', status: true, cookie: true,
10. xfbml: true});
11. };
12. function() {
13. var e = document.createElement('script');
14. e.async = true;
15. //e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
16. 'http://connect.facebook.net/en_US/all.js';
17. 'fb-root').appendChild(e);
18. }());
19. </script>
20. <fb:login-button></fb:login-button>
浏览器中运行看看结果 :