时时商务社区

标题: asp生成google网站地图的xml源代码 [打印本页]

作者: 福多多1989    时间: 2018-2-18 04:48

                  
Dim str,objStream
str = "" & vbcrlf
str = str & "" & vbcrlf
str = str & getfilelink & vbcrlf
str = str & "
" & vbcrlf
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Open
.Charset = "UTF-8"
.Position = objStream.Size
.WriteText=str
.SaveToFile server.mappath("sitemap.xml"),2
.Close
End With
Set objStream = Nothing
If Not Err Then
   Response.Redirect("sitemap.xml")
   Response.End
End If
Function getfilelink()
   SQL="SELECT * FROM 表名 ORDER BY id DESC"
   Dim RS
   Set RS=Server.CreateObject("ADODB.RecordSet")
   RS.Open SQL,Conn,1,1
   IF RS.EOF AND RS.BOF Then
      Response.Write("")
   Else
      Do While NOT RS.EOF
   Y=year(RS("intime"))
   if len(month(RS("intime")))=1 then
   M=0&month(RS("intime"))
   else
   M=month(RS("intime"))
   end if
   if len(day(RS("intime")))=1 then
   D=0&day(RS("intime"))
   else
   D=day(RS("intime"))
   end if
          getfilelink = getfilelink & "http://www.mycodes.net/html/"&RS("Classid")&"/"&RS("ID")&".Html"&Y&"-"&M&"-"&D&""&RS("Title")&"1.0"
          RS.MoveNext
      Loop
   End IF
RS.Close
Set RS=Nothing
Conn.Close
Set Conn=Nothing
End Function
%>





欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2