destoon 怎样去掉关键字互联的strong
functionkeylink($content,$item){global$KEYLINK;$KEYLINKor$KEYLINK=cache_read('keylink...
function keylink($content, $item) {global $KEYLINK;$KEYLINK or $KEYLINK = cache_read('keylink-'.$item.'.php');if(!$KEYLINK) return $content;$data = $content;foreach($KEYLINK as $k=>$v) {$quote = str_replace(array("'", '-'), array("\'", '\-'), preg_quote($v['title']));$data = preg_replace('\'(?!((<.*?)|(]*?)>)|([^>]*?)|([^>]*?))\'si', ''.$v['title'].'', $data, 1);if($data == '') $data = $content;}return $data;}
展开
若以下回答无法解决问题,邀请你更新回答
展开全部
function keylink($content, $item) { global $KEYLINK; $KEYLINK or $KEYLINK = cache_read('keylink-'.$item.'.php'); if(!$KEYLINK) return $content; $data = $content; foreach($KEYLINK as $k=>$v) { $quote = str_replace(array("'", '-'), array("\'", '\-'), preg_quote($v['title'])); $data = preg_replace('\'(?!((<.*?)|(<a.*?)|(<strong.*?)))('.$quote.')(?!(([^<>]*?)>)|([^>]*?</a>)|([^>]*?</strong>))\'si', '<a href="'.$v['url'].'" target="_blank"><strong class="keylink">'.$v['title'].'</strong></a>', $data, 1); if($data == '') $data = $content; } return $data;} 查看原帖>>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询