举个例子是过滤投稿中A链接,就是有A链接的去掉A链接
帝国cms去除投稿中所以URL链接代码
function user_newstextg($mid,$f,$isadd,$isq,$value,$cs){ //去除投稿中所以URL链接
$str1 = preg_replace("/<a[^>]*>/","", $value);
$str2 = preg_replace("/<\/a>/","", $str1);
$str3 = preg_replace("/(<img.*?)(alt=[\"\']?.*?[\"\'])(\s+|>)/",'$1alt="图片来源爱一流网:www.aiyiliu.com"$3',$str2); //过掉掉图片中的ALT正则
return $str3;
}
替换掉图片中ALT
$str1 = preg_replace("/<a[^>]*>/","", $value);
$str2 = preg_replace("/<\/a>/","", $str1); 是替换掉A链接