PHP如何结合UBB代码? 看看ctb里的替换。。<?php$str = "welcome to Csdn.Net !";echo ubb($str);function ubb($msg){ $search_array = array( "/\[code](.*)\[\/code]/isU", "/\Quote:(.*)\[\/quote]/isU", "/\[img]([^'\"\?\&\+]*(\.gif|jpg|jpeg|png|bmp))\[\/img]/iU", "/\[img=([^'\"\?\&\+]*(\.gif|jpg|jpeg|png|bmp))]([^'\"]*)\[\/img]/iU", "/\[url]www.([^'\"]*)\[\/url]/iU", "/\[url]([^'\"]*)\[\/url]/iU", "/\[url=www.([^'\"\s]*)](.*)\[\/url]/iU", "/\[url=([^'\"\s]*)](.*)\[\/url]/iU", "/\[email]([^'\"\s]*)\[\/email]/iU", "/\[email=([^'\"\s]*)](.*)\[\/email]/iU", "/\[b](.*)\[\/b]/isU", "/\[i](.*)\[\/i]/isU", "/\[u](.*)\[\/u]/isU", "/\[size=([1-7])](.*)\[\/size]/isU", "/\[color=(#?[\da-fA-F]{6})](.*)\[\/color]/isU", "/\[color=([a-zA-Z]{3,20})](.*)\[\/color]/isU", "/\[font=([^'\"]*)](.*)\[\/font]/isU", "/\[center](.*)\[\/center]/isU", "/\[right](.*)\[\/right]/isU", "/\[shadow](.*)\[\/shadow]/isU", "/\[glow](.*)\[\/glow]/isU", "/\[fly](.*)\[\/fly]/isU", "/\[move](.*)\[\/move]/isU", "/\[swf]www.([^'\"\s]*)\[\/swf]/iU", "/\[swf]([^'\"\s]*)\[\/swf]/iU", "/\[swf width=([1-6]\d\d) height=([1-9]\d\d)]www.([^'\"\s]*)\[\/swf]/iU", "/\[swf width=([1-6]\d\d) height=([1-9]\d\d)]([^'\"\s]*)\[\/swf]/iU", "/\[mp]([^'\"\s]*)\[\/mp]/iU", "/\[rp]([^'\"\s]*)\[\/rp]/iU", ); $replace_array = array( "<center>代码:<br /><table cellpadding=\"4\" cellspacing=\"1\" class=\"tInner\"><tr class=\"tBody2\"><td style=\"WORD-BREAK: break-all\">\\1</td></tr></table></center>", "<center>引用:<br /><table cellpadding=\"4\" cellspacing=\"1\" class=\"tInner\"><tr class=\"tBody2\"><td style=\"WORD-BREAK: break-all\">\\1</td></tr></table></center>", " <img src=\"\\1\" alt=\"User's Image\" onload=\"if(this.width>screen.width-750) this.width=screen.width-750;\" onmouseover=\"this.style.cursor='hand';\" onclick=\"window.open('\\1');\" /> ", " <img src=\"\\1\" alt=\"\\3\" onload=\"if(this.width>screen.width-750) this.width=screen.width-750;\" onmouseover=\"this.style.cursor='hand';\" onclick=\"window.open('\\1');\" /> ", "<a href=\"http://www.\\1\" target=\"_blank\">www.\\1</a>", "<a href=\"\\1\" target=\"_blank\">\\1</a>", "<a href=\"http://www.\\1\" target=\"_blank\">\\2</a>", "<a href=\"\\1\" target=\"_blank\">\\2</a>", "<a href=\"mailto:\\1\">\\1</a>", "<a href=\"mailto:\\1\">\\2</a>", "<b>\\1</b>", "<i>\\1</i>", "<u>\\1</u>", "<font size=\"\\1\">\\2</font>", "<font color=\"\\1\">\\2</font>", "<font color=\"\\1\">\\2</font>", "<font face=\"\\1\">\\2</font>", "<center>\\1</center>", "<div align=\"right\">\\1</div>", "<table style=\"filter: shadow(color='#ff5555', direction='135')\"><nobr><font color=\"ffffff\">\\1</font></nobr></table>", "<table style=\"filter: glow(color='#5555ff', strength='4')\"><nobr><font color=\"ffffff\">\\1</font></nobr></table>", "<marquee behavior=\"alternate\">\\1</marquee>", "<marquee>\\1</marquee>", "<embed src=\"http://www.\\1\" width=\"400\" height=\"300\"></embed><br />", "<embed src=\"\\1\" width=\"400\" height=\"300\"></embed><br />", "<embed src=\"http://www.\\3\" width=\"\\1\" height=\"\\2\"></embed><br />", "<embed src=\"\\3\" width=\"\\1\" height=\"\\2\"></embed><br />", "<br /><object classid=\"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6\" name=\"MediaPlayer\" codeBase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,1,5,217\" type=\"application/x-oleobject\" standby=\"Loading Microsoft Windows Media Player components...\" width=\"360\" height=\"300\"><param name=\"URL\" value=\"\\1\"><param name=\"autostart\" value=\"false\"></object><br />", "<br /><object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" width=\"360\" height=\"240\"><param name=\"src\" value=\"\\1\"><param name=\"controls\" value=\"ImageWindow\"><param name=\"console\" value=\"console_$this->i\"><param name=\"autostart\" value=\"false\"></object><br /><object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" width=\"360\" height=\"100\"><param name=\"controls\" value=\"All\"><param name=\"console\" value=\"console_$this->i\"></object><br />", ); $msg = preg_replace($search_array, $replace_array, $msg); return $msg;}?> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 感谢啊。谢谢谢谢谢谢。谢谢。 php向数据库中插入ip地址,有必要在插入之前将ip地址整形化么?为了以后方便比对。 想问问这SQL有什么错误 PHP语言strtok分割函数测试 求php上传视频并转换为flv格式 linux系统自带的mysql的路径是怎样的? 单例模式 100分求字段验证最好的解决办法?难道不能实现.net中的效果吗? 写类的时候,规范是什么样的 第一次写的分页类 请问大家一般是如何判断数据库是否存在的?如何判断关系表是否存在? Mysql表设计相关: 这两种查询方式那个快? 字符串问题,请帮帮忙啊。
谢谢。