ubb代码共亨。 |
作者:匿名 发布时间:2002-12-30 来源:php帝国
|
本程序由王猛个人版权所有噢。仅供参考:
<? function get_ubb($text)//$text是文章内容 {//图片 $text=str_replace("[ img ]","<img src=",$text); $text=str_replace("[ /img ]",">",$text);
//链接地址 $arr=explode("[ /url ]",$text); for($i=0;$i<count($arr)-1;$i++) {$tt=explode("[ url ]",$arr[$i]); $k=$tt[1]; $all=$all.$tt[0]."<a href=".$k." target=_blank>".$k."</a>"; } if(count($arr)==1) { $text=$text;} else {$no=count($arr)-1; $text=$all.$arr[$no];}
//邮箱地址 $all=""; $arr=explode("[ /email ]",$text); for($i=0;$i<count($arr)-1;$i++) {$tt=explode("[ email ]",$arr[$i]); $k=$tt[1]; $all=$all.$tt[0]."<a href=mailto:".$k.">".$k."</a>"; } if(count($arr)==1) { $text=$text;} else {$no=count($arr)-1; echo"$arr[$no]"; $text=$all.$arr[$no];} return $text; } //调用 $text=get_ubb($text); ?>
|
|
|
|
|