留言版中插入图片链接 http://zwills.crcoo.com/mikespook/softlist.asp?id=68UBB 代码~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 UBB替换代码~~~function h2t($d){ $d=str_replace("<","<",$d); $d=str_replace(">",">",$d); $d=str_replace("|","│",$d); $d=str_replace("\r","",$d); $d=str_replace("\t","",$d); $d=str_replace("\n","<br>",$d); $d=str_replace(" "," ",$d); $pattern = array( "/\[b\](.+?)\[\/b\]/is", "/\[i\](.+?)\[\/i\]/is", "/\[u\](.+?)\[\/u\]/is", "/\[font=([^\[]*)\](.+?)\[\/font\]/is", "/\[color=([#0-9a-z]{1,10})\](.+?)\[\/color\]/is", "/\[size=([0-9]{1,2})\](.+?)\[\/size\]/is", "/\[email=([^\[]*)\](.+?)\[\/email\]/is", "/\[email\]([^\[]*)\[\/email\]/is", "/\[url=([^\[]*)\](.+?)\[\/url\]/is", "/\[url\]www\.([^\[]*)\[\/url\]/is", "/\[url\]([^\[]*)\[\/url\]/is", "/\[fly\](.+?)\[\/fly\]/is", "/\[move\](.+?)\[\/move\]/is", "/\[align=(left|center|right)\](.+?)\[\/align\]/is", "/\[shadow=([#0-9a-z]{1,10})\,([0-9]{1,3})\,([0-9]{1,2})\](.+?)\[\/shadow\]/is", "/\[glow=([#0-9a-z]{1,10})\,([0-9]{1,2})\](.+?)\[\/glow\]/is", "/\[code\](.+?)\[\/code\]/is", "/\[list\](.+?)\[\/list\]/is", "/\[list=([aA1iI])\](.+?)\[\/list\]/is", "/\[\*\](.*?)/i", ); $replacement = array( "<b>\\1</b>", "<i>\\1</i>", "<u>\\1</u>", "<font face=\"\\1\">\\2</font>", "<font color=\"\\1\">\\2</font>", "<font size=\"\\1\">\\2</font>", "<a href=\"mailto:\\1\">\\2</a>", "<a href=\"mailto:\\1\">\\1</a>", "<a href=\"\\1\" target=_blank>\\2</a>", "<a href=\"http://www.\\1\" target=_blank>\\1</a>", "<a href=\"\\1\" target=_blank>\\1</a>", "<marquee width=90% behavior=alternate scrollamount=3>\\1</marquee>", "<marquee scrollamount=3>\\1</marquee>", "<div align=\\1>\\2</div>", "<table width=*><tr><td style=\"filter:shadow(color=\\1, direction=\\2 ,strength=\\3)\">\\4</td></tr></table>", "<table width=*><tr><td style=\"filter:glow(color=\\1, strength=\\2)\">\\3</td></tr></table>", "<blockquote><b>代码:</b><hr color=#990000><font face='Courier New'>\\1</font><hr color=#990000></blockquote>", "<ul>\\1</ul>", "<ol type=\\1>\\2</ol>", "<li>\\1</li>" ); $d = preg_replace($pattern,$replacement,$d); $d = preg_replace("/\[img\]\s*(\S+?)\s*\[\/img\]/is","<a href=\\1 target=_blank title=\"贴图:点击放大查看\"><img src=\\1 border=0 onload=\"javascript:if(this.width>500)this.width=300\"></a>",$d); return $d;} 只是一个函数而已~~~比如你的留言板要插入图片~使用UBB代码~~~然后留言板就有图片显示~~~$str="留言";h2t($str)返回的就是转换后的~ HOHO,这个我倒是知道~只是想知道这个函数这么写什么意思?正则? 是正则表达式~~~用 $replacement 中对应项替换 $pattern 中的内容。这样就可以实现UBB代码到HTML代码的转换~~ ASPif xxx then response.write ""end if (求助)一个网站项目的具体流程 求帮忙 下载代码怎么写 php ajax 乱码的问题。 高分求解lamp配置安装gd前libpng的安装错误 一个对我来说非常困难的数学公式问题!!! php mysql 问题 在线等 输入一个数字,判断如果不足5位则前面补0,这个怎么做? 关于开源产品的选择 才学php想尝试编一个功能简单的网址导航的网站,页面的大量网址数据从txt,还是从数据库里读取好呢,还是都弄成htm格式的? 求一条信息 用PHP写一个产品发布系统要多长时间,多少钱? 想接受挑战的朋友进来看看~~
$d=str_replace("<","<",$d);
$d=str_replace(">",">",$d);
$d=str_replace("|","│",$d);
$d=str_replace("\r","",$d);
$d=str_replace("\t","",$d);
$d=str_replace("\n","<br>",$d);
$d=str_replace(" "," ",$d);
$pattern = array(
"/\[b\](.+?)\[\/b\]/is",
"/\[i\](.+?)\[\/i\]/is",
"/\[u\](.+?)\[\/u\]/is",
"/\[font=([^\[]*)\](.+?)\[\/font\]/is",
"/\[color=([#0-9a-z]{1,10})\](.+?)\[\/color\]/is",
"/\[size=([0-9]{1,2})\](.+?)\[\/size\]/is",
"/\[email=([^\[]*)\](.+?)\[\/email\]/is",
"/\[email\]([^\[]*)\[\/email\]/is",
"/\[url=([^\[]*)\](.+?)\[\/url\]/is",
"/\[url\]www\.([^\[]*)\[\/url\]/is",
"/\[url\]([^\[]*)\[\/url\]/is",
"/\[fly\](.+?)\[\/fly\]/is",
"/\[move\](.+?)\[\/move\]/is",
"/\[align=(left|center|right)\](.+?)\[\/align\]/is",
"/\[shadow=([#0-9a-z]{1,10})\,([0-9]{1,3})\,([0-9]{1,2})\](.+?)\[\/shadow\]/is",
"/\[glow=([#0-9a-z]{1,10})\,([0-9]{1,2})\](.+?)\[\/glow\]/is",
"/\[code\](.+?)\[\/code\]/is",
"/\[list\](.+?)\[\/list\]/is",
"/\[list=([aA1iI])\](.+?)\[\/list\]/is",
"/\[\*\](.*?)/i",
);
$replacement = array(
"<b>\\1</b>",
"<i>\\1</i>",
"<u>\\1</u>",
"<font face=\"\\1\">\\2</font>",
"<font color=\"\\1\">\\2</font>",
"<font size=\"\\1\">\\2</font>",
"<a href=\"mailto:\\1\">\\2</a>",
"<a href=\"mailto:\\1\">\\1</a>",
"<a href=\"\\1\" target=_blank>\\2</a>",
"<a href=\"http://www.\\1\" target=_blank>\\1</a>",
"<a href=\"\\1\" target=_blank>\\1</a>",
"<marquee width=90% behavior=alternate scrollamount=3>\\1</marquee>",
"<marquee scrollamount=3>\\1</marquee>",
"<div align=\\1>\\2</div>",
"<table width=*><tr><td style=\"filter:shadow(color=\\1, direction=\\2 ,strength=\\3)\">\\4</td></tr></table>",
"<table width=*><tr><td style=\"filter:glow(color=\\1, strength=\\2)\">\\3</td></tr></table>",
"<blockquote><b>代码:</b><hr color=#990000><font face='Courier New'>\\1</font><hr color=#990000></blockquote>",
"<ul>\\1</ul>",
"<ol type=\\1>\\2</ol>",
"<li>\\1</li>"
);
$d = preg_replace($pattern,$replacement,$d);
$d = preg_replace("/\[img\]\s*(\S+?)\s*\[\/img\]/is","<a href=\\1 target=_blank title=\"贴图:点击放大查看\"><img src=\\1 border=0 onload=\"javascript:if(this.width>500)this.width=300\"></a>",$d);
return $d;
}
h2t($str)返回的就是转换后的~
response.write ""
end if