php中Ubb代码编辑器程序代码
发布:smiling 来源: PHP粉丝网 添加日期:2014-07-31 15:17:54 浏览: 评论:0
- <?php
- /*
- php Ubb代码编辑器
- */
- function get_ubb($ubb){
- $ubb=preg_replace("/([B])(.*)([/B])/","<B>2</B>" ,$ubb);//替换B粗体字
- $ubb=preg_replace("/([I])(.*)([/I])/","<I>2</I>" ,$ubb);
- $ubb=preg_replace("/([U])(.*)([/U])/","<U>2</U>" ,$ubb);
- $ubb=preg_replace("/([LEF])(.*)([/LEF])/","<div align=left>2</div>" ,$ubb);
- $ubb=preg_replace("/([MID ])(.*)([/MID ])/","<div align=center>2</div>" ,$ubb);
- $ubb=preg_replace("/([RIG])(.*)([/RIG])/","<div align=right>2</div>" ,$ubb);
- $ubb=preg_replace("/([LINK])(.*)([/LINK])/","<a href=2>2</a>",$ubb);
- $ubb=preg_replace("/([Email])(.*)([/Email])/","<a href=mailto:2>2</a>",$ubb);
- $ubb=preg_replace("/([IMAGE])(.*)([/IMAGE])/","<img src=2>",$ubb);
- $ubb=preg_replace("/([FLASH])(.*)([/FLASH])/","<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=400 height=400><PARAM NAME=movie VALUE="2"><PARAM NAME=quality VALUE=high><embed src="2" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=400 height=400 ></embed></OBJECT>" ,$ubb);
- $ubb=preg_replace("/([MUSIC])(.*)([/MUSIC])/","<embed src=2 autostart=false loop=3>" ,$ubb);
- $ubb=preg_replace("/([PHOTO name=)([0-9]*)(])/","<img src=Ubb_img/biaoqing/2.gif >" ,$ubb);
- $ubb=preg_replace("/([FONT=)(.{1,10})(])(.*)([/FONT])/","<div style=font:2>4</div>" ,$ubb);
- $ubb=preg_replace("/([FONT-SIZE=)([0-9]*)(])(.*)([/FONT-SIZE])/","<div style=font-size:2px>4</div>" ,$ubb);
- $ubb=preg_replace("/([FONT-COLOR=)(.{1,10})(])(.*)([/FONT-COLOR])/","<div style=color:2>4</div>" ,$ubb);
- //$ubb=preg_replace("/([])(.*)([/])/","" ,$ubb);
- return $ubb;
- }
- $str=get_ubb($_POST['cont']);
- $str="<div style=font:宋体>[FONT=黑体]asdasd</div><div style=font:Georgia>asdasdas[/FONT]</div>";
- echo get_ubb($str);
- ?>
Tags: php代码 编辑器程序
- 上一篇:php ajax实现验证用户名是否存在
- 下一篇:php无刷新发表评论实现代码
相关文章
- ·PHP代码优化及PHP相关问题总结(2013-11-27)
- ·一段防盗链的PHP代码(2013-12-08)
- ·PHP代码实现301跳转页面实例(2014-01-11)
- ·非常实用的PHP代码片段(2014-07-03)
- ·PHP代码中swf动画的调用(2014-07-23)
- ·PHP万年历实现程序代码(2014-07-30)
- ·获取checkbox值的php代码(2014-08-04)
- ·用户注册检测用户名是否存在ajax+php代码(2014-08-15)
- ·PHP代码安全性问题的建议(2014-08-25)
- ·php编程代码规范学习笔记(适合初学者)(2015-04-08)
- ·值得收藏的10个PHP代码样例(黑名单\下载文件)(2015-04-08)
- ·判断用户是PC还是移动端的php代码(2015-12-24)
- ·非常有用的9个PHP代码片段(2019-10-04)
- ·9个比较实用的php代码片段(2019-11-18)
- ·PHP代码优化的53个细节(2020-10-12)
- ·9个经典的PHP代码片段分享(2021-05-04)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)