我有下面的代码开始从我的数据库中提取数据,我想插入下面的函数来处理“产品描述”
echo '<Product>
<ID><![CDATA['.$row['ID'].']]></ID>
<ProductName><![CDATA['.htmlspecialchars_decode($row['ProductName']).']]></ProductName>
<ProductCode><![CDATA['.$row['ProductCode'].']]></ProductCode>
<Category><![CDATA['.$row['Category'].' > '.$row['Category_sub_1'].']]></Category>
<Price><![CDATA['.$row['Price'].']]></Price>
<MarketPrice><![CDATA['.$row['MarketPrice'].']]></MarketPrice>
<AvailableQty><![CDATA['.$row['AvailableQty'].']]></AvailableQty>
<Condition><![CDATA['.$row['Condition_new'].']]></Condition>
<Weight><![CDATA['.$row['Weight'].']]></Weight>
<ShippingProductClass><![CDATA['.$row['ShippingProductClass'].']]></ShippingProductClass>
<ImageURL><![CDATA['.$row['ImageURL'].']]></ImageURL>
<ProductDescription><![CDATA['.htmlspecialchars_decode($row['ProductDescription']).']]></ProductDescription>
</Product>
';
}}}
我在哪里放置:
function swearwords($word){
$word = preg_replace('/\b(w{3,4}\.)*(?<!img\.|imgmgr\.)badword(\.com)*\b/iu', '', $word);
return $word;
}