<?
//刚刚学习php1
//编了这个程序,请大家测试!
?>
<?
function usehtml($body,$usehtml){
If ($usehtml==""){
$body=htmlspecialchars($body);
//$body=eregi_replace("<","<",$body);
//$body=eregi_replace(">",">",$body);
If (strstr($body,chr(13))<>"") {
//$body=eregi_replace(" "," ",$body);
$body=eregi_replace(chr(13),"<br>".chr(13).chr(10),$body);
}Else{
$body=eregi_replace(chr(13),"<br>".chr(13).chr(10),$body);
}
$body=eregi_replace(" ","¡¡",$body);
}ElseIf($usehtml=="usehtml") {
If (strstr($body,chr(13))<>"") {
//$body=eregi_replace(" "," ",$body);
$body=eregi_replace(chr(13),"<br>".chr(13).chr(10),$body);
}Else{
$body=eregi_replace(chr(13),"<br>".chr(13).chr(10),$body);
}
$body=eregi_replace(" ","¡¡",$body);
$body=eregi_replace(chr(10)," ",$body);
$body=eregi_replace(chr(13)," ",$body);
$body=eregi_replace(" "," ",$body);
while(Strstr($body, " ")<>""){
$body=eregi_replace(" "," ",$body);
}
$body=eregi_replace("< ","<",$body);
$body=eregi_replace(">"," >",$body);
If (MyLevel>6){
}
$body=eregi_replace(" >",">",$body);
}
return $body;
}
//If Request("Auto_Edit")<>"" Then $body = "<table width=580
//border=0cellspacing=0
//cellpadding=0><tr><td>"&$body&"</td></tr></table>"
?>
上面的程序把文本转化成html里面的body标记的内容,再加上其他的html标记完全就可以成为一个html文件了!
|