如何用PHP读取类似facebook的count

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何用PHP读取类似facebook的count相关的知识,希望对你有一定的参考价值。

When you add facebook like button to your site, probably, you also want to save the number of likes of your pages to your database.These data are very useful and very important because they tell you which of your articles are better than others. Moreover, these pages are better than others because the user has decided to tell his friends about it.
  1. function readFacebookLikes($url) {
  2. $query = "select total_count from link_stat WHERE url ='" . $url ."'";
  3. $s = file_get_contents("https://api.facebook.com/method/fql.query?query=".
  4. urlencode($query)."&format=json");
  5. preg_match("#("total_count"):([0-9]*)#",$s,$ar);
  6. if(isset($ar[2])) return $ar[2]; else return null;
  7. }

以上是关于如何用PHP读取类似facebook的count的主要内容,如果未能解决你的问题,请参考以下文章

PHP 如何用PHP更改Facebook状态

linux下如何用php读取word

如何用opencv读取avi视频并在界面截图进行人脸检测

类似Facebook的按钮

如何用php实现添加无限分类?类似织梦后台那种可以无限添加分类

如何用 python 做一个考勤系统