我正在尝试从数据库中创建一个html文件,我在转义此行时遇到问题"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"
完整代码:
Dim filer As Integer, paths As String
filer = FreeFile
paths = App.Path + "\DB"
Open paths + "\test.html" For Output As #filer
'...
Print #filer, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"
'...
Close #filer
我不知道为什么它显示为红色并且不让我创建.exe
甚至运行它
答案 0 :(得分:2)
你的问题是你试图像在perl或c ++中那样逃避双引号。
尝试使用疯狂的MS双引号 像这样:
Print #filer, "<meta http-equiv=""Content-Type"" content=""text/html; charset=UTF-8"" />"
OR
str1 = "<meta http-equiv=" & chr(34) & "Content-Type" & chr(34) ' etc
Print #filer, str1
修改强>: 更正了行情。
"hello "" BOB"
= Hello " Bob
"""Hello "" BOB"""
= "Hello " BOB"