日期:2011-12-17  浏览次数:20431 次

   关键词高亮

  1. function highlight($sString$aWords) { 
  2.     if (!is_array ($aWords)  emptyempty ($aWords)  !is_string ($sString)) { 
  3.         return false; 
  4.     } 
  5.  
  6.     $sWords = implode (''$aWords); 
  7.     return preg_replace ('@\b('.$sWords.')\b@si''<strong style="background-color:yellow">$1</strong>'$sString); 

  获取你的Feedburner的用户

  1. function get_average_readers($feed_id,$interval = 7){ 
  2.     $today = date('Y-m-d'strtotime("now")); 
  3.     $ago = date('Y-m-d'strtotime("-".$interval." days")); 
  4.     $feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$ago.",".$today
  5.     $ch = curl_init(); 
  6.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
  7.     curl_setopt($ch, CURLOPT_URL, $feed_url); 
  8.     $data = curl_exec($ch); 
  9.     curl_close($ch);