[原创代码]简单的UBB代码

首页 / 源码 / 正文
<?php
/* 
* 花几分钟写的ubb转换html标签实例
 * POWERED BY 雨落凋殇
 */
function ubb($string) { 
$patterns = Array('/\[url=(.*)\](.*)\[\/url\]/U','/\[img=(.*)\](.*)\[\/img\]/U','/\[br\]/','/\[hr\]/');
$replacements = Array('<a href = "\1">\2</a>','<img src = "\1" alt = "\2">','<br />','<hr />');
$str = preg_replace($patterns, $replacements, $string);
return $str;
}?>
评论区
头像