2
我試圖隱藏從註冊會員沒有,BB代碼的作品鏈接,並將其隱藏,但是HTML代碼不起作用。隱藏鏈接在論壇
例如,
[link=http://www.brandbucket.com/]Brand Bucket[/link]
這隱藏很好。
在另一方面..
<a href="http://www.char5.com/" target="_blank">http://www.char5.com</a>
這並不能掩蓋所有的超級鏈接工作正常。
這裏是下面的任何幫助,請,謝謝代碼。
$text = preg_replace("/\[file\=(.*?)\](.*?)\[\/file\]/is", $rep, $text);
$text = preg_replace("/\[link\=(.*?)\](.*?)\[\/link\]/is", $rep, $text);
$text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is", $rep, $text);
$text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<,]*)#is", "\\1".$rep, $text);
$text = preg_replace("#(^|[\n \]])((www|ftp)\.[\w+-]+?\.[\w+\-.]*(?(?=/)(/.+?(?=\s|,\s))|(?=\W)))#is", "\\1".$rep, $text);
沒有任何一個正則表達式模式看起來像他們甚至試圖匹配HTML錨點標記,但我不建議您嘗試。可能值得你看看[DOMDocument](http://php.net/DomDocument)和XPath。 –