php实现转换ubb代码的方法_php技巧
程序员文章站
2022-05-01 16:18:01
...
本文实例讲述了php实现转换ubb代码的方法。分享给大家供大家参考。具体如下:
"),$content);
$content = eregi_replace(quotemeta("
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("
引用: |
"),$content); $content = eregi_replace(quotemeta("[/quote]"),quotemeta(" |
复制代码 代码如下:
"),quotemeta("
"),$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\\]", "\\1",$content);
//$content = preg_replace( '/javascript/i', 'java script', $content);
return $content;
}
代码: |
"),$content); $content = eregi_replace(quotemeta(""),quotemeta(" |
希望本文所述对大家的php程序设计有所帮助。
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频