在基于Wordpress的网站中显示Twitter关注者的数量

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在基于Wordpress的网站中显示Twitter关注者的数量相关的知识,希望对你有一定的参考价值。

Put this code in your theme, where you want to show followers count. Don't forget to change USERNAME.xml to your twitter user name.
  1. <?php
  2. $twit = file_get_contents('http://twitter.com/users/show/USERNAME.xml');
  3.  
  4. $begin = '<followers_count>'; $end = '</followers_count>';
  5. $page = $twit;
  6. $parts = explode($begin,$page);
  7. $page = $parts[1];
  8. $parts = explode($end,$page);
  9. $tcount = $parts[0];
  10.  
  11. if($tcount == '') { $tcount = '0'; }
  12. echo '<b> '.$tcount.' </b> Followers';
  13. ?>

以上是关于在基于Wordpress的网站中显示Twitter关注者的数量的主要内容,如果未能解决你的问题,请参考以下文章