就是[b][/b]转化成
1<b></b>
这样的
马上就要用
谢谢
---------------------------------------------------------------
http://expert.csdn.net/Expert/FAQ/FAQ_Index.asp?id=10863
以下是源代码
'$this->url', 'email' => '$this->email', 'mail' => '$this->email', // 为了容错,[mail]和[email]等效 'img' => '$this->img', 'b' => '$this->simple', 'i' => '$this->simple', 'u' => '$this->simple', 'tt' => '$this->simple', 's' => '$this->simple', 'strike' => '$this->simple', 'h1' => '$this->simple', 'h2' => '$this->simple', 'h3' => '$this->simple', 'h4' => '$this->simple', 'h5' => '$this->simple', 'h6' => '$this->simple', 'sup' => '$this->simple', 'sub' => '$this->simple', 'em' => '$this->simple', 'strong' => '$this->simple', 'code' => '$this->simple', 'samp' => '$this->simple', 'kbd' => '$this->simple', 'var' => '$this->simple', 'dfn' => '$this->simple', 'cite' => '$this->simple', 'small' => '$this->simple', 'big' => '$this->simple', 'blink' => '$this->simple', 'fly' => '$this->fly', 'move' => '$this->move', 'glow' => '$this->CSSStyle', 'shadow' => '$this->CSSStyle', 'blur' => '$this->CSSStyle', 'wave' => '$this->CSSStyle', 'sub' => '$this->simple', 'sup' => '$this->simple', 'size' => '$this->size', 'face' => '$this->face', 'font' => '$this->face', // 为了容错,[font]和[face]等效 'color' => '$this->color' ); function ubbcode() { $this->$nest= 0; $this->$sLastModified= sprintf("%s", date("Y-m-j H:i", getlastmod())); } /*********************************************************************** * 对使用者输入的 E-Mail 作简单的检查, * 检查使用者的 E-Mail 字串是否有 @ 字元, * 在 @ 字元前有英文字母或数字,在之后有数节字串, * 最后的小数点后只能有二个或三个英文字母。 * [email protected] 就可以通过检查,[email protected] 就不能通过检查 ************************************************************************/ function emailcheck($str) { if (eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3}$", $str)) return true; else return false; } /*********************************************************************** * 对使用者输入的 URL 作简单的检查, * 目前只能简单判断,不能自动检查fpt,finger等 ************************************************************************/ function checkURL($str) { $bValidURL= true; if (eregi("([a-z0-9-]+([\\.][a-z0-9\\-]+)+)", $str, $er_arr)) { /* printf ("0. %s `````` \n", $er_arr[0]); printf ("1. %s ```
``` \n", $er_arr[1]); printf ("2. %s ```
``` \n", $er_arr[2]); printf ("3. %s ```
``` \n", $er_arr[3]); printf ("4. %s ```
``` \n", $er_arr[4]); */ } else $bValidURL= false; return $bValidURL; } /*********************************************************************** * 对使用者输入的 图片URL 作简单的检查, * 目前只能简单判断结尾是否为图片文件 * 不支持由CGI动态生成的图片,比如计数器这类的 ************************************************************************/ function checkImgURL($str) \--------------------------------------------------------------- function ubb($Text) { $Text=htmlspecialchars($Text); $Text=stripslashes($Text); $Text=ereg_replace("\r\n"," ",$Text); $Text=ereg_replace("\r"," ",$Text); $Text=nl2br($Text); $Text=preg_replace("/\\\t/is"," ",$Text); $Text=ereg_replace(" "," ",$Text); $Text=preg_replace("/\\[h1\\](.+?)\\[\/h1\\]/is"," ```
\\\1
``` ",$Text); $Text=preg_replace("/\\[h2\\](.+?)\\[\/h2\\]/is"," ```\\\1
``` ",$Text); $Text=preg_replace("/\\[h3\\](.+?)\\[\/h3\\]/is"," ```\\\1
``` ",$Text); $Text=preg_replace("/\\[h4\\](.+?)\\[\/h4\\]/is"," ```\\\1
``` ",$Text); $Text=preg_replace("/\\[h5\\](.+?)\\[\/h5\\]/is"," ```\\\1
``` ",$Text); $Text=preg_replace("/\\[h6\\](.+?)\\[\/h6\\]/is"," ```\\\1
``` ",$Text); $Text=preg_replace("/\\[center\\](.+?)\\[\/center\\]/is"," ```\\\1``` ",$Text); $Text=preg_replace("/\\[email\\](.+?)\\[\/email\\]/is"," ``` \\\1 ``` ",$Text); $Text=preg_replace("/\\[i\\](.+?)\\[\/i\\]/is"," ``` \\\1 ``` ",$Text); $Text=preg_replace("/\\[b\\](.+?)\\[\/b\\]/is"," ``` \\\1 ``` ",$Text); $Text=preg_replace("/\\[quote\\](.+?)\\[\/quote\\]/is"," ```
quote:``` ", $Text);
\\\1