从数据库中读取出来的文章如何控制格式,读出来的没有换行等样式

2024-12-05 06:23:02
推荐回答(2个)
回答1:

Function TextEncode(ByVal Str)
If Trim(Str) = "" Or IsNull(Str) Then TextEncode = "": Exit Function
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, Chr(32), " ")
Str = Replace(Str, Chr(9), " ")
Str = Replace(Str, Chr(34), """)
Str = Replace(Str, Chr(39), "'")
Str = Replace(Str, Chr(13), "")
Str = Replace(Str, Chr(10), "
")
TextEncode = Str
End Function

输出文章内容
Response.Write TextEncode(文章内容字段)
希望对你能有所帮助。

回答2:

你存这些文本的时候没有加格式么?