本文实例讲述了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("