内容替换不在超链接中

时间:2016-08-31 21:56:11

标签: php

我有一个简单的功能,即我的网站上的所有内容都会被过滤掉,以便对公司名称进行首映。这是功能:

function brand_capitilize($content) {
    $content = str_replace("Brand", "BRAND", $content);
    return $content;
}

如果它在网址中,我需要修改它以忽略“品牌”这个词。例如,我不希望在以下情况下将“品牌”这个词大写:

<a href="http://mycompany.com/files/Brand.pdf">View PDF</a>

如果我现在通过brand_capitilize()提供这个,我最终得到:

<a href="http://mycompany.com/files/BRAND.pdf">View PDF</a>

0 个答案:

没有答案