自动为文章标签添加该标签的链接

function tag_link($content){

global $CACHE;

$tag_cache = $CACHE->readCache('tags');

foreach($tag_cache as $value){

$tag_url = Url::tag($value['tagurl']);

$keyword = $value['tagname'];

$cleankeyword = stripslashes($keyword);

$url = "{$cleankeyword}";

$regEx = '\'(?!((<.*?)|(]*?)>)|([^>]*?))\'s';

$content = preg_replace($regEx,$url,$content);

}

return $content;

}

你可能感兴趣的:(自动为文章标签添加该标签的链接)