【 tulaoshi.com - Web开发 】
function ubb($Text) {
$Text=htmlspecialchars($Text);
$Text=ereg_replace("rn","br",$Text);
$Text=ereg_replace("r","br",$Text);
$Text=nl2br($Text);
$Text=preg_replace("/t/is"," ",$Text);
$Text=preg_replace("/[h1](.+?)[/h1]/is","h11/h1",$Text);
$Text=preg_replace("/[h2](.+?)[/h2]/is","h21/h2",$Text);
$Text=preg_replace("/[h3](.+?)[/h3]/is","h31/h3",$Text);
$Text=preg_replace("/[h4](.+?)[/h4]/is","h41/h4",$Text);
$Text=preg_replace("/[h5](.+?)[/h5]/is","h51/h5",$Text);
$Text=preg_replace("/[h6](.+?)[/h6]/is","h61/h6",$Text);
$Text=preg_replace("/[url](http://.+?)[/url]/is","a href=11/a",$Text);
$Text=preg_replace("/[url](.+?)[/url]/is","a href="http://1"http://1/a",$Text);
$Text=preg_replace("/[url=(http://.+?)](.*)[/url]/is","a href=12/a",$Text);
$Text=preg_replace("/[url=(.+?)](.*)[/url]/is","a href=http://12/a",$Text);
$Text=preg_replace("/[img](.+?)[/img]/is","img src=1",$Text);
$Text=preg_replace("/[color=(.+?)](.+?)[/color]/is","font color=12/font",$Text);
$Text=preg_replace("/[size=(.+?)](.+?)[/size]/is","font size=12/font",$Text);
$Text=preg_replace("/[sup](.+?)[/sup]/is","sup1/sup",$Text);
$Text=preg_replace("/[sub](.+?)[/sub]/is","sub1/sub",$Text);
$Text=preg_replace("/[pre](.+?)[/pre]/is","pre1/pre",$Text);
$Text=preg_replace("/[email](.+?)[/email]/is","a href=11/a",$Text);
$Text=preg_replace("/[i](.+?)[/i]/is","i1/i",$Text);
$Text=preg_replace("/[b](.+?)[/b]/is","b1/b",$Text);
$Text=preg_replace("/[quote](.+?)[/quote]/is","blockquotefont size='2' face='Courier New'quote:/fonthr1hr/blockquote", $Text);
$Text=preg_replace("/[code](.+?)[/code]/is","blockquotefont size='2' face='Courier New'code:/fonthr color='lightblue'i1/ihr color='lightblue'/blockquote", $Text);
$Text=preg_replace("/[sig](.+?)[/sig]/is","div style='text-align: left; color: darkgreen; margin-left: 5%'brbr--------------------------br1br--------------------------/div", $Text);
return $Text;
}
function str($msg){
global $admin;
if(!$admin[html]) $msg=htmlspecialchars($msg);
if($admin[ubb]) $msg=ubb($msg);
$msg=nl2br($msg); #处理message
$msg= str_replace("n","",$msg); #处理message
$msg= str_replace("r","",$msg); #处理message
return $msg;
}
function error($msg){
global $admin;
?
中的
$Text=preg_replace("/[h2](.+?)[/h2]/is","h21/h2",$Text);
里面的 ("/[h2](.+?)[/h2]/is","h21/h2",$text)
/[h2](.+?)[/h2]/is 转化成 h21/h2
/[h2](.+?)[/h2]/is 里面的 这些"/(.+?) "之类的符号是怎么看的?是什么意思?
______________________________________________________________________________________________
是转意,本身是特殊符号,如果要作为普通字符就要用来转意,就是说表示()也是特殊符号,所以要用转意