PHP implementation of the method of converting UBB code, PHP conversion UBB code
This article describes the PHP implementation of the conversion Ubb code method. Share to everyone for your reference. Specific as follows:
function ubb2html ($content) {global $article;//whether automatic recognition of if ($article [' isparseurl '] = = "1") {$content = parseURL ($content);} Automatic recognition End $content = Eregi_replace (Quotemeta ("[b]"), Quotemeta (""), $content), $content = Eregi_replace (" [/b] "), Quotemeta (""), $content), $content = Eregi_replace (" [i] "), Quotemeta (""), $content), $content = Eregi_replace (" [/I] "), Quotemeta (""), $content), $content = Eregi_replace (" [u] "), Quotemeta (""), $content), $content = Eregi_replace (Quotemeta (" [/U] "), Quotemeta (""), $content), $content = Eregi_replace (" [Center] "), Quotemeta ("
"), $content), $content = Eregi_replace (" [/center] "), Quotemeta ("
"), $content), $content = Eregi_replace (" [quote] "), Quotemeta ("
Reference: |
|
"), $content), $content = Eregi_replace (" [/quote] "), Quotemeta (" |
|
"), $content); $content = Eregi_replace (Quotemeta ("
Copy CodeThe code is as follows: "), Quotemeta ("
Code: |
|
"), $content); $con Tent = Eregi_replace (Quotemeta (""), Quotemeta (" |
|
"), $content); $content = Eregi_replace (" \\[images\\ "([^\\[]*) \\[/images\\]", "screen.width-333) this.width= Screen.width-333\ "Title=\" with a new window to browse the original picture \ ">", $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;}
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1019056.html www.bkjia.com true http://www.bkjia.com/PHPjc/1019056.html techarticle PHP Implementation of the method of converting UBB code, PHP conversion UBB Code This article describes the PHP implementation of the conversion Ubb code method. Share to everyone for your reference. Specific as follows: Function ubb2html ($ ...