• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php UBB 解析实现代码_php技巧

php 搞代码 3年前 (2022-01-26) 24次浏览 已收录 0个评论
 <BR>/** <BR>+---------------------------------------------------------- <BR>* UBB 解析 <BR>+---------------------------------------------------------- <BR>* @return string <BR>+---------------------------------------------------------- <BR>*/ <BR>function ubb($Text) { <BR>$Text=trim($Text); <BR>$Text=ereg_replace("\n","<br>",$Text); <BR>$Text=preg_replace("/\\t/is"," <em>/本2文来源[email protected]搞@^&代*@码2网</em><strong>搞gaodaima代码</strong>",$Text); <BR>$Text=preg_replace("/\[hr\]/is","<hr>",$Text); <BR>$Text=preg_replace("/\[separator\]/is","<br />",$Text); <BR>$Text=preg_replace("/\[h1\](.+?)\[\/h1\]/is","<h1>\\1</h1>",$Text); <BR>$Text=preg_replace("/\[h2\](.+?)\[\/h2\]/is","<h2>\\1</h2>",$Text); <BR>$Text=preg_replace("/\[h3\](.+?)\[\/h3\]/is","<h3>\\1</h3>",$Text); <BR>$Text=preg_replace("/\[h4\](.+?)\[\/h4\]/is","<h4>\\1</h4>",$Text); <BR>$Text=preg_replace("/\[h5\](.+?)\[\/h5\]/is","<h5>\\1</h5>",$Text); <BR>$Text=preg_replace("/\[h6\](.+?)\[\/h6\]/is","<h6>\\1</h6>",$Text); <BR>$Text=preg_replace("/\[center\](.+?)\[\/center\]/is","\\1",$Text); <BR>//$Text=preg_replace("/\[url=([^\[]*)\](.+?)\[\/url\]/is","\\2",$Text); <BR>$Text=preg_replace("/\[url\](.+?)\[\/url\]/is","\\1",$Text); <BR>$Text=preg_replace("/\[url=(http:\/\/.+?)\](.+?)\[\/url\]/is","\\2",$Text); <BR>$Text=preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/is","\\2",$Text); <BR>$Text=preg_replace("/\[img\](.+?)\[\/img\]/is","",$Text); <BR>$Text=preg_replace("/\[img\s(.+?)\](.+?)\[\/img\]/is","",$Text); <BR>$Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","<font color="\\1">\\2</font>",$Text); <BR>$Text=preg_replace("/\[colorTxt\](.+?)\[\/colorTxt\]/eis","color_txt('\\1')",$Text); <BR>$Text=preg_replace("/\[style=(.+?)\](.+?)\[\/style\]/is","<div class='\\1'>\\2

“,$Text);
$Text=preg_replace(“/\[size=(.+?)\](.+?)\[\/size\]/is”,”\\2“,$Text);
$Text=preg_replace(“/\[sup\](.+?)\[\/sup\]/is”,”\\1“,$Text);
$Text=preg_replace(“/\[sub\](.+?)\[\/sub\]/is”,”\\1“,$Text);
$Text=preg_replace(“/\[pre\](.+?)\[\/pre\]/is”,”

\\1

“,$Text);
$Text=preg_replace(“/\[emot\](.+?)\[\/emot\]/eis”,”emot(‘\\1’)”,$Text);
$Text=preg_replace(“/\[email\](.+?)\[\/email\]/is”,”\\1″,$Text);
$Text=preg_replace(“/\[i\](.+?)\[\/i\]/is”,”\\1“,$Text);
$Text=preg_replace(“/\[u\](.+?)\[\/u\]/is”,”\\1“,$Text);
$Text=preg_replace(“/\[b\](.+?)\[\/b\]/is”,”\\1“,$Text);
$Text=preg_replace(“/\[quote\](.+?)\[\/quote\]/is”,”

引用:

\\1

“, $Text);
$Text=preg_replace(“/\[code\](.+?)\[\/code\]/eis”,”highlight_code(‘\\1’)”, $Text);
$Text=preg_replace(“/\[php\](.+?)\[\/php\]/eis”,”highlight_code(‘\\1’)”, $Text);
$Text=preg_replace(“/\[sig\](.+?)\[\/sig\]/is”,”

————————–
\\1
————————–

“, $Text);
return $Text;
}


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php UBB 解析实现代码_php技巧
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址