日期:2011-12-17 浏览次数:20468 次
关键词高亮
- function highlight($sString, $aWords) {
- if (!is_array ($aWords) emptyempty ($aWords) !is_string ($sString)) {
- return false;
- }
- $sWords = implode ('', $aWords);
- return preg_replace ('@\b('.$sWords.')\b@si', '<strong style="background-color:yellow">$1</strong>', $sString);
- }
获取你的Feedburner的用户
- function get_average_readers($feed_id,$interval = 7){
- $today = date('Y-m-d', strtotime("now"));
- $ago = date('Y-m-d', strtotime("-".$interval." days"));
- $feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$ago.",".$today;
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_URL, $feed_url);
- $data = curl_exec($ch);
- curl_close($ch);