Php implements the ubb Code Conversion Method, and php converts ubb Code
This article describes how php converts ubb code. Share it with you for your reference. The details are as follows:
Function ubb2html ($ content) {global $ article; // whether to automatically recognize if ($ article ['isparseurl'] = "1 ") {$ content = parseurl ($ content);} // automatically identifies end $ content = eregi_replace (quotemeta ("[B]"), quotemeta ("<B> "), $ content); $ content = eregi_replace (quotemeta ("[/B]"), quotemeta ("</B>"), $ content ); $ content = eregi_replace (quotemeta ("[I]"), quotemeta ("<I>"), $ content ); $ content = eregi_replace (quotemeta ("[/I]"), quotemeta ("</I>"), $ content ); $ content = eregi_replace (quotemeta ("[u]"), quotemeta ("<u>"), $ content ); $ content = eregi_replace (quotemeta ("[/u]"), quotemeta ("</u>"), $ content ); $ content = eregi_replace (quotemeta ("[center]"), quotemeta ("<center>"), $ content ); $ content = eregi_replace (quotemeta ("[/center]"), quotemeta ("</center>"), $ content ); $ content = eregi_replace (quotemeta ("[quote]"), quotemeta ("<table width = \" 96% \ "border = \" 0 \ "cellspacing = \" 3 \ "cellpadding = \" 0 \ "style = word-break: break-all align = \ "center \"> <tr> <td> <B> reference: </B> </td> </tr> <td> Copy codeThe Code is as follows :"), quotemeta ("<table width = \" 96% \ "border = \" 0 \ "cellspacing = \" 3 \ "cellpadding = \" 0 \ "style = word-break: break-all align = \ "center \"> <tr> <td> <B> code: </B> </td> </tr> <td>
I hope this article will help you with php programming.