php实现转换ubb代码的方法

前端之家收集整理的这篇文章主要介绍了php实现转换ubb代码的方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了PHP实现转换ubb代码方法分享给大家供大家参考。具体如下:

PHP;"> function ubb2html($content) { global $article; //是否自动识别 if ($article['isparseurl'] == "1") { $content = parseurl($content); } //自动识别结束 $content = eregi_replace(quoteMeta("[b]"),quoteMeta(""),$content); $content = eregi_replace(quoteMeta("[/b]"),quoteMeta(""),$content); $content = eregi_replace(quoteMeta("[i]"),quoteMeta(""),$content); $content = eregi_replace(quoteMeta("[/i]"),quoteMeta(""),$content); $content = eregi_replace(quoteMeta("[u]"),quoteMeta(""),$content); $content = eregi_replace(quoteMeta("[/u]"),quoteMeta(""),$content); $content = eregi_replace(quoteMeta("[center]"),quoteMeta("
"),$content); $content = eregi_replace(quoteMeta("[/center]"),quoteMeta("
"),$content); $content = eregi_replace(quoteMeta("[quote]"),quoteMeta("引用:Meta("[/quote]"),quoteMeta("Meta("
代码如下:
Meta("
代码:Meta(""),$content); $content = eregi_replace("\\[images\\]([^\\[]*)\\[/images\\]","screen.width-333)this.width=screen.width-333\" title=\"用新窗口浏览原始图片\">",$content); $content = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","www.\\1",$content); $content = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","\\1",$content); $content = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","\\2",$content); $content = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]","",$content); //$content = preg_replace( '/javascript/i','java script',$content); return $content; }

希望本文所述对大家的PHP程序设计有所帮助。

原文链接:https://www.f2er.com/php/21736.html

猜你在找的PHP相关文章